function initCal() {

	cal = new dhtmlxCalendarObject(calIDs, true, {
		isYearEditable : true
	});
	cal.options.weekstart = 1;

	cal.setOnClickHandler(addCalMods);

}
function addCalMods() {
	for ( var i = 0; i < calIDs.size(); i++)
		addChangedModality(calIDs[i]);
}

function doInitWin() {
	dhxWins = new dhtmlXWindows();
	dhxWins.enableAutoViewport(true);
	dhxWins.setImagePath("scripts/dhtmlxwindows-codebase/imgs/");
}

function initForm() {
	$('preSurgeryTreatmentDetail').disable();
	$('preSurgeryTreatmentDetailOther').disable();
	$('micronodularCirrhosis').disable();
	$('macronodularCirrhosis').disable();
	$('inflammationType').disable();
	$('extraHepaticInvasionTissue').disable();
	$('otherLesionsMisc').disable();
	$('otherLesionsMisc').hide();
	$('diabetesType').disable();
	$('diabetesYears').disable();
	$('ageMenopause').disable();
	$('nChildren').disable();
	$('oralContraception').disable();
	$('contraceptionAgeFirstUse').disable();
	$('contraceptionYearsUsed').disable();
	$('contraceptionType').disable();
	$('alcoholQuantity').disable();
	$('tobaccoQuantity').disable();
	$('otherGeographicOrigin').disable();
	$('familyMalignantPrimaryLiverTumorsDescription').disable();
	$('familyHistoryMalignantTumorsDescription').disable();
	$('familyDiabetesType').disable();
	$('longTermDrugsYears').disable();
	$('longTermDrugsTypes').disable();
	$('longTermDrugsMisc').disable();
	$('newTissueFieldSet').hide();
	$('relapseTreatmentMisc').disable();

	$('newMasterTissueDiv').hide();

	Tissue
			.addMethods({
				toButton : function() {
					var buttonString = '<input type=\'button\' value=' + '\'' + this.toString()
							+ '\'' + ' onClick=\"loadTissue(' + this.chcID + ',\''
							+ this.tissueTypeID + '\')\"/>';
					return buttonString;
				}
			});

	loadTissues();

}

function loadTissues() {
	new Ajax.Request('mainServlet', {
		method : 'POST',
		parameters : {
			appAction : 'ajaxLoadTissueList'
		},
		onFailure : function(transport) {
			handleErrorResponseWindow(transport.responseText); // cf. common.js
		},
		onSuccess : function(transport) {
			var jsonResponse = transport.responseText;
			existingTissuesList = jsonResponse.evalJSON();
		}
	});

	loadTissueTypes();
}

function loadTissueTypes() {
	new Ajax.Request('mainServlet', {
		method : 'POST',
		parameters : {
			appAction : 'ajaxLoadTissueTypes'
		},
		onFailure : function(transport) {
			handleErrorResponseWindow(transport.responseText); // cf. common.js
		},
		onSuccess : function(transport) {
			var jsonResponse = transport.responseText;
			existingTissueTypesList = jsonResponse.evalJSON();

			var tissueTypeOptionsString = "";
			for ( var i = 0; i < existingTissueTypesList.size(); i++) {
				tissueTypeOptionsString += '<option>';
				tissueTypeOptionsString += existingTissueTypesList[i];
				tissueTypeOptionsString += '</option>';
			}
			$('newMasterTissueTypeID').update(tissueTypeOptionsString);

		}
	});
}

function addChangedModality(modality) {
	if (changedModalities.indexOf(modality) == -1)
		changedModalities.push(modality);
}

function removeMasterTissue(tissueCHCID, tissueTissueTypeID, masterTissueCHCID,
		masterTissueTissueTypeID) {
	var t = new Tissue({
		chcID : tissueCHCID,
		tissueTypeID : tissueTissueTypeID
	});
	var mt = new Tissue({
		chcID : masterTissueCHCID,
		tissueTypeID : masterTissueTissueTypeID
	});
	var proceed = confirm('You are about to dissociate the tissue ' + t.toString()
			+ ' from its current master tissue ' + mt.toString()
			+ '. Are you sure you want to continue ?');
	if (proceed) {
		new Ajax.Request('mainServlet', {
			method : 'POST',
			parameters : {
				appAction : 'ajaxDissociateMasterTissue',
				tissueCHCID : tissueCHCID,
				tissueTypeID : String.interpret(tissueTissueTypeID)
			},
			onFailure : function(transport) {
				handleErrorResponseWindow(transport.responseText);
			},
			onSuccess : function(transport) {
				var message = 'The tissue ' + mt.toHref() + ' is not the master tissue of '
						+ t.toString() + ' anymore !';
				successWindow(message);
				loadTissue(tissueCHCID, tissueTissueTypeID);
			}
		});
	}

}

function associateNewMaster() {
	var t = new Tissue(currentTissue);
	var mt = new Tissue({
		chcID : $('newMasterTissueCHCID').getValue().trim(),
		tissueTypeID : $('newMasterTissueTypeID').getValue()
	});
	var exists = false;
	for ( var i = 0; i < existingTissuesList.size(); i++) {
		if (mt.equals(existingTissuesList[i])) {
			exists = true;
			mt = new Tissue(existingTissuesList[i]);
		}
	}
	if (!exists) {
		alert('The master tissue ' + mt.toString() + ' doesn\'t exist in the database !');
	}
	else if (t.equals(mt)) {
		alert('A tissue cannot be associated with itself !');
	}
	else {

		if (mt.hasMasterTissue()) {
			var message = 'You cannot use the tissue ' + mt.toHref() + ' as a master tissue, '
					+ 'since it already has a master tissue (' + mt.getMasterTissue().toHref()
					+ ').<br/>Perhaps you should use ' + mt.getMasterTissue().toHref()
					+ ' as master tissue instead.';
			handleErrorResponseWindow(message);
		}
		else {
			new Ajax.Request('mainServlet', {
				method : 'POST',
				parameters : {
					appAction : 'ajaxAssociateNewTissueWithMaster',
					tissueCHCID : String.interpret(t.chcID),
					tissueTissueTypeID : t.tissueTypeID,
					masterTissueCHCID : String.interpret(mt.chcID),
					masterTissueTypeID : mt.tissueTypeID
				},
				onFailure : function(transport) {
					handleErrorResponseWindow(transport.responseText); // cf.
					// common.js
				},
				onSuccess : function(transport) {
					var message = 'Tissue : ' + t.toString() + ' successfully associated'
							+ ' with master Tissue : ' + mt.toHref();
					successWindow(message);
					loadTissue(t.chcID, t.tissueTypeID);

				}
			});
		}
	}
}

function loadSelectedTissue() {
	var s = $('tissueListSelect').value;
	// element tissueListSelect is defined in
	// includes/ajax/tissueListSelect.jsp
	var chcID = s.split("-")[0];
	var tissueTypeID = s.split("-")[1];
	loadTissue(chcID, tissueTypeID);
}

function saveTissue() {

	newModalities.set("chcID", currentTissue.chcID);
	newModalities.set("tissueTypeID", currentTissue.tissueTypeID);

	// ---------- TISSUE INFO ---------- //

	// SIMPLE DIAGNOSIS
	if (changedModalities.indexOf('simpleDiagnosis') != -1) {
		var formValue = $('simpleDiagnosis').getValue();
		var dbVarName = 'Diagnosis_B_Benign_M_Malignant_NT_Non_tumoral';
		newModalities.set(dbVarName, formValue);
	}

	// SAMPLE ORIGIN
	if (changedModalities.indexOf('sampleType') != -1) {
		var formValue = $('sampleType').getValue();
		var dbVarName = 'MiscData_TissueSampleOrigin';
		newModalities.set(dbVarName, formValue);
	}

	// ---------- CLINICAL DATA ---------- //

	// CLINICAL CENTER
	if (changedModalities.indexOf('clinicalCenter') != -1) {
		newModalities.set("ClinicalData_ClinicalCenter", $('clinicalCenter').getValue().trim());
	}

	// RECEPTION DATE
	if (changedModalities.indexOf('receptionDate') != -1)
		newModalities.set("ClinicalData_ReceptionDate", $('receptionDate').getValue());

	// ANAPTATH ID
	if (changedModalities.indexOf('anapathID') != -1)
		newModalities.set("ClinicalData_AnapathID", $('anapathID').getValue().trim());

	// FIRST NAME
	if (changedModalities.indexOf('firstName') != -1)
		newModalities.set("ClinicalData_FirstName", $('firstName').getValue().trim());

	// SEX
	if (changedModalities.indexOf('sex') != -1) {
		if ($('sex').getValue() == "M")
			newModalities.set("ClinicalData_Sex", "M");
		else if ($('sex').getValue() == "F")
			newModalities.set("ClinicalData_Sex", "F");
	}

	// AGE
	if (changedModalities.indexOf('age') != -1)
		newModalities.set("ClinicalData_Age", $('age').getValue().trim());

	// DATE OF BIRTH
	if (changedModalities.indexOf('birthDate') != -1)
		newModalities.set("ClinicalData_BirthDate", $('birthDate').getValue());

	// PLACE OF BIRTH
	if (changedModalities.indexOf('placeOfBirth') != -1)
		newModalities.set("ClinicalData_BirthPlace", $('placeOfBirth').getValue().trim());

	// NUMBER OF CHILDREN
	if (changedModalities.indexOf('nChildren') != -1)
		newModalities.set("ClinicalData_nbChildren", $('nChildren').getValue().trim());

	// AGE AT MENOPAUSE
	if (changedModalities.indexOf('ageMenopause') != -1)
		newModalities.set("ClinicalData_AgeMenopause", $('ageMenopause').getValue().trim());

	// PROFESSION
	if (changedModalities.indexOf('profession') != -1)
		newModalities.set("ClinicalData_Profession", $('profession').getValue().trim());

	// SURGERY DATE
	if (changedModalities.indexOf('surgeryDate') != -1)
		newModalities.set("ClinicalData_SurgeryDate", $('surgeryDate').getValue().trim());

	// PRE SURGERY TREATMENT
	if (changedModalities.indexOf('preSurgeryTreatment') != -1) {
		if ($('preSurgeryTreatment').getValue() == 'YES')
			newModalities.set("ClinicalData_PreSurgeryTreatment", 'TRUE');
		else if ($('preSurgeryTreatment').getValue() == 'NO')
			newModalities.set("ClinicalData_PreSurgeryTreatment", 'FALSE');
		else if ($('preSurgeryTreatment').getValue() == 'NA')
			newModalities.set("ClinicalData_PreSurgeryTreatment", 'NA');
	}

	// PRE SURGERY TREATMENT TYPE
	if (changedModalities.indexOf('preSurgeryTreatmentDetail') != -1) {
		if ($('preSurgeryTreatmentDetail').options[0].selected == true)
			newModalities.set('ClinicalData_PreSurgeryTreatment_HepaticTranplantation', 'TRUE');
		if ($('preSurgeryTreatmentDetail').options[1].selected == true)
			newModalities.set('ClinicalData_PreSurgeryTreatment_Hepatectomy', 'TRUE');
		if ($('preSurgeryTreatmentDetail').options[2].selected == true)
			newModalities.set('ClinicalData_PreSurgeryTreatment_Chemotherapy', 'TRUE');
		if ($('preSurgeryTreatmentDetail').options[3].selected == true)
			newModalities.set('ClinicalData_PreSurgeryTreatment_Chemoembolization', 'TRUE');
		if ($('preSurgeryTreatmentDetail').options[4].selected == true)
			newModalities.set('ClinicalData_PreSurgeryTreatment_Other', $(
					'preSurgeryTreatmentDetailOther').getValue().trim());
		if ($('preSurgeryTreatmentDetail').options[5].selected == true) {
			newModalities.set('ClinicalData_PreSurgeryTreatment_HepaticTranplantation', 'NULL');
			newModalities.set('ClinicalData_PreSurgeryTreatment_Hepatectomy', 'NULL');
			newModalities.set('ClinicalData_PreSurgeryTreatment_Chemotherapy', 'NULL');
			newModalities.set('ClinicalData_PreSurgeryTreatment_Chemoembolization', 'NULL');
			newModalities.set('ClinicalData_PreSurgeryTreatment_Other', 'NULL');
		}
	}

	// ---------- BIOLOGICAL DATA ---------- //

	// ALPHAFOETO
	if (changedModalities.indexOf('alphaFoeto') != -1)
		newModalities.set("BiologicalData_Alphafoeto", $('alphaFoeto').getValue().trim());

	// BILLIRUBIN
	if (changedModalities.indexOf('billirubin') != -1)
		newModalities.set("BiologicalData_Billirubin", $('billirubin').getValue().trim());

	// ALBUMIN
	if (changedModalities.indexOf('albumin') != -1)
		newModalities.set("BiologicalData_Albumin", $('albumin').getValue().trim());

	// TP
	if (changedModalities.indexOf('tp') != -1)
		newModalities.set("BiologicalData_TP", $('tp').getValue().trim());

	// CHILD-PUGH
	if (changedModalities.indexOf('childPugh') != -1) {
		if ($('childPugh').getValue() == 'A')
			newModalities.set("BiologicalData_ChildPugh", 'A');
		else if ($('childPugh').getValue() == 'B')
			newModalities.set("BiologicalData_ChildPugh", 'B');
		else if ($('childPugh').getValue() == 'C')
			newModalities.set("BiologicalData_ChildPugh", 'C');
		else if ($('childPugh').getValue() == 'NA')
			newModalities.set("BiologicalData_ChildPugh", 'NA');
		else if ($('childPugh').getValue() == '-')
			newModalities.set("BiologicalData_ChildPugh", 'NULL');
	}

	// ASCITES
	if (changedModalities.indexOf('ascites') != -1) {
		if ($('ascites').getValue() == 'YES')
			newModalities.set('BiologicalData_Ascites', 'TRUE');
		else if ($('ascites').getValue() == 'NO')
			newModalities.set('BiologicalData_Ascites', 'FALSE');
		else if ($('ascites').getValue() == 'NA')
			newModalities.set("BiologicalData_Ascites", 'NA');
		else if ($('ascites').getValue() == '-')
			newModalities.set("BiologicalData_Ascites", 'NULL');
	}

	// ---------- NT LIVER DATA ---------- //

	// NORMAL LIVER HISTOLOGY
	if (changedModalities.indexOf('normalLiverHistology') != -1) {
		if ($('normalLiverHistology').getValue() == 'Cirrhosis')
			newModalities.set("NTLiver_Histology", "CIRR.");
		else if ($('normalLiverHistology').getValue() == 'Chronic Active Hepatitis')
			newModalities.set("NTLiver_Histology", "HCA");
		else if ($('normalLiverHistology').getValue() == 'Portal Fibrosis')
			newModalities.set("NTLiver_Histology", "FP");
		else if ($('normalLiverHistology').getValue() == 'Normal Liver')
			newModalities.set("NTLiver_Histology", "FN");
		else if ($('normalLiverHistology').getValue() == 'Hepatoportal Sclerosis')
			newModalities.set("NTLiver_Histology", "SHP");
		else if ($('normalLiverHistology').getValue() == '-')
			newModalities.set("NTLiver_Histology", "NULL");
		else if ($('normalLiverHistology').getValue() == 'NA')
			newModalities.set("NTLiver_Histology", "NA");
	}

	// MACRO/MICRONODULAR CIRRHOSIS
	if (changedModalities.indexOf('macronodularCirrhosis') != -1) {
		if ($('macronodularCirrhosis').checked == true
				&& $('micronodularCirrhosis').checked == true)
			newModalities.set("NTLiver_CirrhosisType", "MIXED");
		else if ($('macronodularCirrhosis').checked == true
				&& $('micronodularCirrhosis').checked == false)
			newModalities.set("NTLiver_CirrhosisType", "Macronodular");
		else if ($('macronodularCirrhosis').checked == false
				&& $('micronodularCirrhosis').checked == true)
			newModalities.set("NTLiver_CirrhosisType", "Micronodular");
		else if ($('macronodularCirrhosis').checked == false
				&& $('micronodularCirrhosis').checked == false)
			newModalities.set("NTLiver_CirrhosisType", "NULL");
	}

	// METAVIR ACTIVITY
	if (changedModalities.indexOf('AMetavir') != -1) {
		if ($('AMetavir').getValue() == 'A0')
			newModalities.set('NTLiver_MetavirActivity', '0');
		else if ($('AMetavir').getValue() == 'A1')
			newModalities.set('NTLiver_MetavirActivity', '1');
		else if ($('AMetavir').getValue() == 'A2')
			newModalities.set('NTLiver_MetavirActivity', '2');
		else if ($('AMetavir').getValue() == 'A3')
			newModalities.set('NTLiver_MetavirActivity', '3');
		else if ($('AMetavir').getValue() == 'NA')
			newModalities.set('NTLiver_MetavirActivity', 'NA');
		else if ($('AMetavir').getValue() == '-')
			newModalities.set('NTLiver_MetavirActivity', 'NULL');
	}

	// METAVIR FIBROSIS
	if (changedModalities.indexOf("FMetavir") != -1) {
		if ($("FMetavir").getValue() == "F0")
			newModalities.set("NTLiver_MetavirFibrosis", "0");
		else if ($("FMetavir").getValue() == "F1")
			newModalities.set("NTLiver_MetavirFibrosis", "1");
		else if ($("FMetavir").getValue() == "F2")
			newModalities.set("NTLiver_MetavirFibrosis", "2");
		else if ($("FMetavir").getValue() == "F3")
			newModalities.set("NTLiver_MetavirFibrosis", "3");
		else if ($("FMetavir").getValue() == "F4")
			newModalities.set("NTLiver_MetavirFibrosis", "4");
		else if ($("FMetavir").getValue() == "NA")
			newModalities.set("NTLiver_MetavirFibrosis", "-");
		else if ($("FMetavir").getValue() == "NA")
			newModalities.set("NTLiver_MetavirFibrosis", "NULL");
	}

	// IRON OVERLOAD (SEARLE)
	if (changedModalities.indexOf('ironOverloadValue') != -1) {
		if ($('ironOverloadValue').getValue() == 0)
			newModalities.set('NTLiver_IronOverloadSearle_Degree', '0');
		else if ($('ironOverloadValue').getValue() == 1)
			newModalities.set('NTLiver_IronOverloadSearle_Degree', '1');
		else if ($('ironOverloadValue').getValue() == 2)
			newModalities.set('NTLiver_IronOverloadSearle_Degree', '2');
		else if ($('ironOverloadValue').getValue() == 3)
			newModalities.set('NTLiver_IronOverloadSearle_Degree', '3');
		else if ($('ironOverloadValue').getValue() == 4)
			newModalities.set('NTLiver_IronOverloadSearle_Degree', '4');
		else if ($('ironOverloadValue').getValue() == 'NA')
			newModalities.set('NTLiver_IronOverloadSearle_Degree', 'NA');
		else if ($('ironOverloadValue').getValue() == '-')
			newModalities.set('NTLiver_IronOverloadSearle_Degree', 'NULL');
	}

	// NT LIVER STEATOSIS
	if (changedModalities.indexOf('ntSteatosis') != -1) {
		if ($('ntSteatosis').getValue() == 0)
			newModalities.set('NTLiver_Steatosis', '0');
		else if ($('ntSteatosis').getValue() == 1)
			newModalities.set('NTLiver_Steatosis', '1');
		else if ($('ntSteatosis').getValue() == 2)
			newModalities.set('NTLiver_Steatosis', '2');
		else if ($('ntSteatosis').getValue() == 3)
			newModalities.set('NTLiver_Steatosis', '3');
		else if ($('ntSteatosis').getValue() == 4)
			newModalities.set('NTLiver_Steatosis', '4');
		else if ($('ntSteatosis').getValue() == 'NA')
			newModalities.set('NTLiver_Steatosis', 'NA');
		else if ($('ntSteatosis').getValue() == '-')
			newModalities.set('NTLiver_Steatosis', 'NULL');
	}

	// HEPATOCYTIC DYSPLASIA
	if (changedModalities.indexOf('hepatocyticDysplasia') != -1) {
		if ($('hepatocyticDysplasia').getValue() == 'Small Cells')
			newModalities.set('NTLiver_HepatocyticDysplasia', 'Small Cells');
		else if ($('hepatocyticDysplasia').getValue() == 'Large Cells')
			newModalities.set('NTLiver_HepatocyticDysplasia', 'Large Cells');
		else if ($('hepatocyticDysplasia').getValue() == 'Both')
			newModalities.set('NTLiver_HepatocyticDysplasia', 'Both');
		else if ($('hepatocyticDysplasia').getValue() == 'None')
			newModalities.set('NTLiver_HepatocyticDysplasia', 'None');
		else if ($('hepatocyticDysplasia').getValue() == 'NA')
			newModalities.set('NTLiver_HepatocyticDysplasia', 'NA');
		else if ($('hepatocyticDysplasia').getValue() == '-')
			newModalities.set('NTLiver_HepatocyticDysplasia', 'NULL');
	}

	// ASSOCIATED TUMOR
	if (changedModalities.indexOf('associatedTumor') != -1) {
		if ($('associatedTumor').getValue() == 'Adenoma')
			newModalities.set('NTLiver_AssociatedTumor', 'Adenoma');
		else if ($('associatedTumor').getValue() == 'FNH')
			newModalities.set('NTLiver_AssociatedTumor', 'FNH');
		else if ($('associatedTumor').getValue() == 'Angioma')
			newModalities.set('NTLiver_AssociatedTumor', 'Angioma');
		else if ($('associatedTumor').getValue() == 'HNR')
			newModalities.set('NTLiver_AssociatedTumor', 'HNR');
		else if ($('associatedTumor').getValue() == 'NA')
			newModalities.set('NTLiver_AssociatedTumor', 'NA');
		else if ($('associatedTumor').getValue() == '-')
			newModalities.set('NTLiver_AssociatedTumor', 'NULL');
	}

	// OTHER LESION
	if (changedModalities.indexOf('otherLesions') != -1) {
		if ($('otherLesions').getValue() == 'Von Meyenburg complexes')
			newModalities.set('NTLiver_OtherLesions', 'Von Meyenburg complexes');
		else if ($('otherLesions').getValue() == 'Glycogenic foci')
			newModalities.set('NTLiver_OtherLesions', 'Glycogenic foci');
		else if ($('otherLesions').getValue() == 'Peliosis')
			newModalities.set('NTLiver_OtherLesions', 'Peliosis');
		else if ($('otherLesions').getValue() == 'Biliary adenoma')
			newModalities.set('NTLiver_OtherLesions', 'Biliary adenoma');
		else if ($('otherLesions').getValue() == 'NA')
			newModalities.set('NTLiver_OtherLesions', 'NA');
		else if ($('otherLesions').getValue() == 'Other')
			newModalities.set('NTLiver_OtherLesions', $('otherLesionsMisc').getValue().trim());
		else if ($('otherLesions').getValue() == '-')
			newModalities.set('NTLiver_OtherLesions', 'NULL');
	}

	// ---------- RISK FACTORS ---------- //

	// HBV
	if (changedModalities.indexOf('hbv') != -1) {
		if ($('hbv').getValue() == 'YES')
			newModalities.set("RiskFactors_HBV_status", "TRUE");
		else if ($('hbv').getValue() == "NO")
			newModalities.set("RiskFactors_HBV_status", "FALSE");
		else if ($('hbv').getValue() == "NA")
			newModalities.set("RiskFactors_HBV_status", "NA");
		else if ($('hbv').getValue() == "-")
			newModalities.set("RiskFactors_HBV_status", "NULL");
	}

	// AGHBS
	if (changedModalities.indexOf('agHBs') != -1) {
		if ($('agHBs').getValue() == 'YES')
			newModalities.set('RiskFactors_HBV_AgHBs', 'TRUE');
		else if ($('agHBs').getValue() == 'NO')
			newModalities.set('RiskFactors_HBV_AgHBs', 'FALSE');
		else if ($('agHBs').getValue() == 'NA')
			newModalities.set('RiskFactors_HBV_AgHBs', 'NA');
		else if ($('agHBs').getValue() == '-')
			newModalities.set('RiskFactors_HBV_AgHBs', 'NULL');
	}

	// ACHBC
	if (changedModalities.indexOf('acHBc') != -1) {
		if ($('acHBc').getValue() == 'YES')
			newModalities.set('RiskFactors_HBV_AcHBc', 'TRUE');
		else if ($('acHBc').getValue() == 'NO')
			newModalities.set('RiskFactors_HBV_AcHBc', 'FALSE');
		else if ($('acHBc').getValue() == 'NA')
			newModalities.set('RiskFactors_HBV_AcHBc', 'NA');
		else if ($('acHBc').getValue() == '-')
			newModalities.set('RiskFactors_HBV_AcHBc', 'NULL');
	}

	// HBV VIRAL DNA
	if (changedModalities.indexOf('hbvViralDNA') != -1) {
		if ($('hbvViralDNA').getValue() == 'YES')
			newModalities.set('RiskFactors_HBV_ViralDNA', 'TRUE');
		else if ($('hbvViralDNA').getValue() == 'NO')
			newModalities.set('RiskFactors_HBV_ViralDNA', 'FALSE');
		else if ($('hbvViralDNA').getValue() == 'NA')
			newModalities.set('RiskFactors_HBV_ViralDNA', 'NA');
		else if ($('hbvViralDNA').getValue() == '-')
			newModalities.set('RiskFactors_HBV_ViralDNA', 'NULL');
	}

	// PCR HBX NT LIVER
	if (changedModalities.indexOf('pcrHBXNTLiver') != -1) {
		if ($('pcrHBXNTLiver').getValue() == 'YES')
			newModalities.set('RiskFactors_PCR_HBX_NTLiver', 'TRUE');
		else if ($('pcrHBXNTLiver').getValue() == 'NO')
			newModalities.set('RiskFactors_PCR_HBX_NTLiver', 'FALSE');
		else if ($('pcrHBXNTLiver').getValue() == 'NA')
			newModalities.set('RiskFactors_PCR_HBX_NTLiver', 'NA');
		else if ($('pcrHBXNTLiver').getValue() == '-')
			newModalities.set('RiskFactors_PCR_HBX_NTLiver', 'NULL');
	}

	// PCR HBX T LIVER
	if (changedModalities.indexOf('pcrHBXTLiver') != -1) {
		if ($('pcrHBXTLiver').getValue() == 'YES')
			newModalities.set('RiskFactors_PCR_HBX_TLiver', 'TRUE');
		else if ($('pcrHBXTLiver').getValue() == 'NO')
			newModalities.set('RiskFactors_PCR_HBX_TLiver', 'FALSE');
		else if ($('pcrHBXTLiver').getValue() == 'NA')
			newModalities.set('RiskFactors_PCR_HBX_TLiver', 'NA');
		else if ($('pcrHBXTLiver').getValue() == '-')
			newModalities.set('RiskFactors_PCR_HBX_TLiver', 'NULL');
	}

	// HBV HISTOCHEMISTRY
	if (changedModalities.indexOf('hbvHistoChemistry') != -1) {
		if ($('hbvHistoChemistry').getValue() == 'YES')
			newModalities.set('RiskFactors_HBV_Histochemistry', 'TRUE');
		else if ($('hbvHistoChemistry').getValue() == 'NO')
			newModalities.set('RiskFactors_HBV_Histochemistry', 'FALSE');
		else if ($('hbvHistoChemistry').getValue() == 'NA')
			newModalities.set('RiskFactors_HBV_Histochemistry', 'NA');
		else if ($('hbvHistoChemistry').getValue() == '-')
			newModalities.set('RiskFactors_HBV_Histochemistry', 'NULL');
	}

	// HCV
	if (changedModalities.indexOf('hcv') != -1) {
		if ($('hcv').getValue() == 'YES')
			newModalities.set("RiskFactors_HCV_status", 'TRUE');
		else if ($('hcv').getValue() == 'NO')
			newModalities.set("RiskFactors_HCV_status", 'FALSE');
		else if ($('hcv').getValue() == 'NA')
			newModalities.set("RiskFactors_HCV_status", 'NA');
		else if ($('hcv').getValue() == '-')
			newModalities.set("RiskFactors_HCV_status", 'NULL');
	}

	// ACHCV
	if (changedModalities.indexOf('acHCV') != -1) {
		if ($('acHCV').getValue() == 'YES')
			newModalities.set('RiskFactors_HCV_AcHCV', 'TRUE');
		else if ($('acHCV').getValue() == 'NO')
			newModalities.set('RiskFactors_HCV_AcHCV', 'FALSE');
		else if ($('acHCV').getValue() == 'NA')
			newModalities.set('RiskFactors_HCV_AcHCV', 'NA');
		else if ($('acHCV').getValue() == '-')
			newModalities.set('RiskFactors_HCV_AcHCV', 'NULL');
	}

	// PCR HCV NT LIVER
	if (changedModalities.indexOf('pcrHCVNTLiver') != -1) {
		if ($('pcrHCVNTLiver').getValue() == 'YES')
			newModalities.set('RiskFactors_HCV_PCR_HCV_NTLiver', 'TRUE');
		else if ($('pcrHCVNTLiver').getValue() == 'NO')
			newModalities.set('RiskFactors_HCV_PCR_HCV_NTLiver', 'FALSE');
		else if ($('pcrHCVNTLiver').getValue() == 'NA')
			newModalities.set('RiskFactors_HCV_PCR_HCV_NTLiver', 'NA');
		else if ($('pcrHCVNTLiver').getValue() == '-')
			newModalities.set('RiskFactors_HCV_PCR_HCV_NTLiver', 'NULL');
	}

	// PCR HCV T LIVER
	if (changedModalities.indexOf('pcrHCVTLiver') != -1) {
		if ($('pcrHCVTLiver').getValue() == 'YES')
			newModalities.set('RiskFactors_HCV_PCR_HCV_TLiver', 'TRUE');
		else if ($('pcrHCVTLiver').getValue() == 'NO')
			newModalities.set('RiskFactors_HCV_PCR_HCV_TLiver', 'FALSE');
		else if ($('pcrHCVTLiver').getValue() == 'NA')
			newModalities.set('RiskFactors_HCV_PCR_HCV_TLiver', 'NA');
		else if ($('pcrHCVTLiver').getValue() == '-')
			newModalities.set('RiskFactors_HCV_PCR_HCV_TLiver', 'NULL');
	}

	// OTHER VIRUS
	if (changedModalities.indexOf('otherVirus') != -1) {
		var formValue = $('otherVirus').getValue().trim();
		var dbVarName = 'RiskFactors_OtherVirus';
		newModalities.set(dbVarName, formValue);
	}

	// AUTOIMMUNE DISEASE
	if (changedModalities.indexOf('autoimmuneDisease') != -1) {
		var formValue = $('autoimmuneDisease').getValue();
		var dbVarName = 'RiskFactors_AutoimmuneDisease';
		if (formValue != '-' && formValue != 'NO')
			newModalities.set(dbVarName, formValue);
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// ALCOHOL
	if (changedModalities.indexOf('alcohol') != -1) {
		var formValue = $('alcohol').getValue();
		var dbVarName = 'RiskFactors_Alcohol';
		if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'Occasional')
			newModalities.set(dbVarName, 'Occasional');
		else if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// ALCOHOL QUANTITY
	if (changedModalities.indexOf('alcoholQuantity') != -1) {
		var formValue = $('alcoholQuantity').getValue();
		if (formValue != '-')
			newModalities.set('RiskFactors_AlcoholQuantity', formValue);
	}

	// TOBACCO
	if (changedModalities.indexOf('tobacco') != -1) {
		var formValue = $('tobacco').getValue();
		var dbVarName = 'RiskFactors_Tobacco';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// TOBACCO QUANTITY
	if (changedModalities.indexOf('tobaccoQuantity') != -1) {
		var formValue = $('tobaccoQuantity').getValue().trim();
		var dbVarName = 'RiskFactors_TobaccoPacksPerYear';
		newModalities.set(dbVarName, formValue);
	}

	// HEMOCHROMATOSIS
	if (changedModalities.indexOf('hemochromatosis') != -1) {
		var formValue = $('hemochromatosis').getValue();
		var dbVarName = 'RiskFactors_Hemochromatosis';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// GLYCOGENOSIS
	if (changedModalities.indexOf('glycogenosis') != -1) {
		var formValue = $('glycogenosis').getValue();
		var dbVarName = 'RiskFactors_Glycogenosis';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// NASH
	if (changedModalities.indexOf('NASH') != -1) {
		var formValue = $('NASH').getValue();
		var dbVarName = 'RiskFactors_NASH';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'Suspicion')
			newModalities.set(dbVarName, 'Suspicion');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// DIABETES
	if (changedModalities.indexOf('diabetes') != -1) {
		var formValue = $('diabetes').getValue();
		var dbVarName = 'RiskFactors_Diabetes';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// DIABETES YEARS
	if (changedModalities.indexOf('diabetesYears') != -1) {
		var formValue = $('diabetesYears').getValue().trim();
		var dbVarName = 'RiskFactors_DiabetesYears';
		newModalities.set(dbVarName, formValue);
	}

	// DIABETES TYPES
	if (changedModalities.indexOf('diabetesType') != -1) {
		var formValue = $('diabetesType').getValue();
		var dbVarName = 'RiskFactors_DiabetesType';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
	}

	// DIABETES YEARS
	if (changedModalities.indexOf('bmi') != -1) {
		var formValue = $('bmi').getValue().trim();
		var dbVarName = 'RiskFactors_BMI';
		newModalities.set(dbVarName, formValue);
	}

	// HEIGHT
	if (changedModalities.indexOf('height') != -1) {
		var formValue = $('height').getValue().trim();
		var dbVarName = 'RiskFactors_Height';
		newModalities.set(dbVarName, formValue);
	}

	// DIABETES YEARS
	if (changedModalities.indexOf('weight') != -1) {
		var formValue = $('weight').getValue().trim();
		var dbVarName = 'RiskFactors_Weight';
		newModalities.set(dbVarName, formValue);
	}

	// ORAL CONTRACEPTION
	if (changedModalities.indexOf('oralContraception') != -1) {
		var formValue = $('oralContraception').getValue();
		var dbVarName = 'RiskFactors_OralContraception';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// ORAL CONTRACEPTION - AGE AT FIRST USE
	if (changedModalities.indexOf('contraceptionAgeFirstUse') != -1) {
		var formValue = $('contraceptionAgeFirstUse').getValue().trim();
		var dbVarName = 'RiskFactors_OralContraception_AgeAtFirstUse';
		newModalities.set(dbVarName, formValue);
	}

	// ORAL CONTRACEPTION - NUMBER OF YEARS USED
	if (changedModalities.indexOf('contraceptionYearsUsed') != -1) {
		var formValue = $('contraceptionYearsUsed').getValue().trim();
		var dbVarName = 'RiskFactors_OralContraception_YearsOfUse';
		newModalities.set(dbVarName, formValue);
	}

	// ORAL CONTRACEPTION - CONTRACEPTION TYPE
	if (changedModalities.indexOf('contraceptionType') != -1) {
		var formValue = $('contraceptionType').getValue().trim();
		var dbVarName = 'RiskFactors_OralContraception_Type';
		newModalities.set(dbVarName, formValue);
	}

	// ON LONG TERM DRUGS USE
	if (changedModalities.indexOf('longTermDrugs') != -1) {
		var formValue = $('longTermDrugs').getValue();
		var dbVarName = 'RiskFactors_OnLongTermDrugs';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// ON LONG TERM DRUGS USE - YEARS OF USE
	if (changedModalities.indexOf('longTermDrugsYears') != -1) {
		var formValue = $('longTermDrugsYears').getValue().trim();
		var dbVarName = 'RiskFactors_OnLongTermDrugs_YearsUsed';
		newModalities.set(dbVarName, formValue);
	}

	// ON LONG TERM DRUGS USE - DRUGS USED
	if (changedModalities.indexOf('longTermDrugsTypes') != -1) {
		var formOptions = $('longTermDrugsTypes').options;
		if (formOptions[0].selected == true)
			newModalities.set('RiskFactors_OnLongTermDrugs_Barbiturates', 'TRUE');
		else
			newModalities.set('RiskFactors_OnLongTermDrugs_Barbiturates', '');

		if (formOptions[1].selected == true)
			newModalities.set('RiskFactors_OnLongTermDrugs_Hormones', 'TRUE');
		else
			newModalities.set('RiskFactors_OnLongTermDrugs_Hormones', '');

		if (formOptions[2].selected == true)
			newModalities.set('RiskFactors_OnLongTermDrugs_SexualHormones', 'TRUE');
		else
			newModalities.set('RiskFactors_OnLongTermDrugs_SexualHormones', '');

		if (formOptions[3].selected == true)
			newModalities.set('RiskFactors_OnLongTermDrugs_Steroids', 'TRUE');
		else
			newModalities.set('RiskFactors_OnLongTermDrugs_Steroids', '');

		if (formOptions[4].selected == true) {// other long term drugs
			var formValue = $('longTermDrugsMisc').getValue().trim();
			newModalities.set('RiskFactors_OnLongTermDrugs_Other', formValue);
		}

		if (formOptions[5].selected == true) {

			newModalities.set('RiskFactors_OnLongTermDrugs_Barbiturates', 'NULL');
			newModalities.set('RiskFactors_OnLongTermDrugs_Hormones', 'NULL');
			newModalities.set('RiskFactors_OnLongTermDrugs_SexualHormones', 'NULL');
			newModalities.set('RiskFactors_OnLongTermDrugs_Steroids', 'NULL');
			newModalities.set('RiskFactors_OnLongTermDrugs_Other', 'NULL');
		}
	}

	// GEOGRAPHIC ORIGIN
	if (changedModalities.indexOf('geographicOrigin') != -1) {
		var formValue = $('geographicOrigin').getValue();
		var dbVarName = 'RiskFactors_GeographicOrigin';
		if (formValue != '-' && formValue != 'Other')
			newModalities.set(dbVarName, formValue);
		else if (formValue == 'Other')
			newModalities.set(dbVarName, $('otherGeographicOrigin').getValue().trim());
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// STAY > 6 MONTHS IN AFRICA
	if (changedModalities.indexOf('stayInAfrica') != -1) {
		var formValue = $('stayInAfrica').getValue();
		var dbVarName = 'RiskFactors_StayedInAfricaMoreThan6Months';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}
	// STAY > 6 MONTHS IN ASIA
	if (changedModalities.indexOf('stayInAsia') != -1) {
		var formValue = $('stayInAsia').getValue();
		var dbVarName = 'RiskFactors_StayedInAsiaMoreThan6Months';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// OTHER RISK FACTOR
	if (changedModalities.indexOf('riskFactorsMisc') != -1) {
		var formValue = $('riskFactorsMisc').getValue().trim();
		var dbVarName = 'RiskFactors_Misc';
		newModalities.set(dbVarName, formValue);
	}

	// ---------- FAMILY DATA ---------- //

	// DIABETES
	if (changedModalities.indexOf('familyDiabetes') != -1) {
		var formValue = $('familyDiabetes').getValue();
		var dbVarName = 'FamilyData_Diabetes';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// DIABETES TYPE
	if (changedModalities.indexOf('familyDiabetesType') != -1) {
		var formOptions = $('familyDiabetesType').options;
		if (formOptions[0].selected == true)
			newModalities.set('FamilyData_Diabetes_Type1', 'TRUE');
		else
			newModalities.set('FamilyData_Diabetes_Type1', 'NULL');

		if (formOptions[1].selected == true)
			newModalities.set('FamilyData_Diabetes_Type2', 'TRUE');
		else
			newModalities.set('FamilyData_Diabetes_Type2', 'NULL');

		if (formOptions[2].selected == true)
			newModalities.set('FamilyData_Diabetes_MODY3', 'TRUE');
		else
			newModalities.set('FamilyData_Diabetes_MODY3', 'NULL');
	}

	// TREATMENT / REGIMEN
	if (changedModalities.indexOf('familyTreatmentRegimen') != -1) {
		var formOptions = $('familyTreatmentRegimen').options;
		if (formOptions[0].selected == true)
			newModalities.set('FamilyData_Treatment_Hypertension', 'TRUE');
		else
			newModalities.set('FamilyData_Treatment_Hypertension', 'NULL');

		if (formOptions[1].selected == true)
			newModalities.set('FamilyData_Treatment_Hypercholesterolemia', 'TRUE');
		else
			newModalities.set('FamilyData_Treatment_Hypercholesterolemia', 'NULL');

		if (formOptions[2].selected == true)
			newModalities.set('FamilyData_Treatment_Hypertriglyceridemia', 'TRUE');
		else
			newModalities.set('FamilyData_Treatment_Hypertriglyceridemia', 'NULL');

		if (formOptions[3].selected == true)
			newModalities.set('FamilyData_Treatment_Diabetes', 'TRUE');
		else
			newModalities.set('FamilyData_Treatment_Diabetes', 'NULL');
	}

	// OBESITY
	if (changedModalities.indexOf('familyObesity') != -1) {
		var formValue = $('familyObesity').getValue();
		var dbVarName = 'FamilyData_Obesity';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// POLYPOSIS COLI
	if (changedModalities.indexOf('familyPolyposisColi') != -1) {
		var formValue = $('familyPolyposisColi').getValue();
		var dbVarName = 'FamilyData_PolyposisColi';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// ADENOMAS ADENOMATOSIS MODY3
	if (changedModalities.indexOf('familyAdenomasAdenomatosisMODY3') != -1) {
		var formValue = $('familyAdenomasAdenomatosisMODY3').getValue();
		var dbVarName = 'FamilyData_LiverAdenomasAdenomatosisMODY3';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// MALIGNANT PRIMARY LIVER TUMORS
	if (changedModalities.indexOf('familyMalignantPrimaryLiverTumors') != -1) {
		var formValue = $('familyMalignantPrimaryLiverTumors').getValue();
		var dbVarName = 'FamilyData_MalignantPrimaryLiverTumors';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// MALIGNANT PRIMARY LIVER TUMORS DESCRIPTION
	if (changedModalities.indexOf('familyMalignantPrimaryLiverTumorsDescription') != -1) {
		var formValue = $('familyMalignantPrimaryLiverTumorsDescription').getValue().trim();
		var dbVarName = 'FamilyData_MalignantPrimaryLiverTumors_Description';
		newModalities.set(dbVarName, formValue);
	}

	// MALIGNANT TUMORS
	if (changedModalities.indexOf('familyHistoryMalignantTumors') != -1) {
		var formValue = $('familyHistoryMalignantTumors').getValue();
		var dbVarName = 'FamilyData_HistoryMalignantTumors';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// MALIGNANT TUMORS DESCRIPTION
	if (changedModalities.indexOf('familyHistoryMalignantTumorsDescription') != -1) {
		var formValue = $('familyHistoryMalignantTumorsDescription').getValue().trim();
		var dbVarName = 'FamilyData_HistoryMalignantTumors_Description';
		newModalities.set(dbVarName, formValue);
	}

	// ---------- SURVIVAL DATA ---------- //

	// LAST NEWS DATE
	if (changedModalities.indexOf('lastNewsDate') != -1) {
		var formValue = $('lastNewsDate').getValue();
		var dbVarName = 'SurvivalData_lastNewsDate';
		newModalities.set(dbVarName, formValue);
	}

	// IS ALIVE
	if (changedModalities.indexOf('isAlive') != -1) {
		var formValue = $('isAlive').checked ? 'TRUE' : 'FALSE';
		var dbVarName = 'SurvivalData_isAlive';
		newModalities.set(dbVarName, formValue);
	}

	// ALIVE W/WO RELAPSE
	if (changedModalities.indexOf('aliveWithOrWithoutRelapse') != -1) {
		var formValue = $('aliveWithOrWithoutRelapse').getValue();
		var dbVarName = 'SurvivalData_AliveWithOrWithoutRelapse';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else
			newModalities.set(dbVarName, 'NULL');
	}

	// RELAPSE DATE
	if (changedModalities.indexOf('relapseDate') != -1) {
		var formValue = $('relapseDate').getValue();
		var dbVarName = 'SurvivalData_RelapseDate';
		newModalities.set(dbVarName, formValue);
	}

	// IS DECEASED
	if (changedModalities.indexOf('isDeceased') != -1) {
		var formValue = $('isDeceased').checked ? 'TRUE' : 'FALSE';
		var dbVarName = 'SurvivalData_isDeceased';
		newModalities.set(dbVarName, formValue);
	}

	// CAUSE OF DEATH
	if (changedModalities.indexOf('deathFromDiseaseOtherEtiology') != -1) {
		var formValue = $('deathFromDiseaseOtherEtiology').getValue();
		var dbVarName = 'SurvivalData_DeathFromDiseaseOrOtherEtiology';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else
			newModalities.set(dbVarName, 'NULL');
	}

	// DATE of DEATH
	if (changedModalities.indexOf('dateOfDeath') != -1) {
		var formValue = $('dateOfDeath').getValue();
		var dbVarName = 'SurvivalData_DateOfDeath';
		newModalities.set(dbVarName, formValue);
	}

	// SURVIVAL WO/ RELAPSE
	if (changedModalities.indexOf('survivalWoRelapse') != -1) {
		var formValue = $('survivalWoRelapse').getValue().trim();
		var dbVarName = 'SurvivalData_SurvivalWithoutRelapse';
		newModalities.set(dbVarName, formValue);
	}

	// TOTAL SURVIVAL
	if (changedModalities.indexOf('totalSurvival') != -1) {
		var formValue = $('totalSurvival').getValue().trim();
		var dbVarName = 'SurvivalData_TotalSurvival';
		newModalities.set(dbVarName, formValue);
	}

	// ---------- RELAPSE TREATMENT ---------- //
	if (changedModalities.indexOf('relapseTreatment') != -1) {

		var formOptions = $('relapseTreatment').options;
		if (formOptions[0].selected == true)
			newModalities.set('RelapseData_RelapseTreatment_HepaticTransplantation', 'TRUE');
		else
			newModalities.set('RelapseData_RelapseTreatment_HepaticTransplantation', 'NULL');

		if (formOptions[1].selected == true)
			newModalities.set('RelapseData_RelapseTreatment_Hepatectomy', 'TRUE');
		else
			newModalities.set('RelapseData_RelapseTreatment_Hepatectomy', 'NULL');

		if (formOptions[2].selected == true)
			newModalities.set('RelapseData_RelapseTreatment_Chemoembolization', 'TRUE');
		else
			newModalities.set('RelapseData_RelapseTreatment_Chemoembolization', 'NULL');

		if (formOptions[3].selected == true)
			newModalities.set('RelapseData_RelapseTreatment_Alcoholization', 'TRUE');
		else
			newModalities.set('RelapseData_RelapseTreatment_Alcoholization', 'NULL');

		if (formOptions[4].selected == true)
			newModalities.set('RelapseData_RelapseTreatment_Chemotherapy', 'TRUE');
		else
			newModalities.set('RelapseData_RelapseTreatment_Chemotherapy', 'NULL');

		if (formOptions[5].selected == true)
			newModalities.set('RelapseData_RelapseTreatment_Other', $('relapseTreatmentMisc')
					.getValue().trim());
		else
			newModalities.set('RelapseData_RelapseTreatment_Other', 'NULL');
	}
	else if (changedModalities.indexOf('relapseTreatmentMisc') != -1) {
		newModalities.set('RelapseData_RelapseTreatment_Other', $('relapseTreatmentMisc')
				.getValue().trim());
	}

	// ---------- PATHOLOGICAL DATA ---------- //

	// NB DISTAL NODULES
	if (changedModalities.indexOf('nbDistalNodules') != -1) {
		var formValue = $('nbDistalNodules').getValue().trim();
		var dbVarName = 'PathologicalData_nbDistalNodules';
		newModalities.set(dbVarName, formValue);
	}

	// DISTAL SATELLITES NODULES
	if (changedModalities.indexOf('distalSatelliteNodules') != -1) {
		var formValue = $('distalSatelliteNodules').getValue();
		var dbVarName = 'PathologicalData_DistalSatelliteNodules';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// VASCULAR INVASION
	if (changedModalities.indexOf('vascularInvasion') != -1) {
		var formValue = $('vascularInvasion').getValue();
		var dbVarName = 'PathologicalData_VascularInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// PORTAL INVASION
	if (changedModalities.indexOf('portalInvasion') != -1) {
		var formValue = $('portalInvasion').getValue();
		var dbVarName = 'PathologicalData_PortalVein_Invasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// MACROSCOPIC PORTAL INVASION
	if (changedModalities.indexOf('macroscopicPortalInvasion') != -1) {
		var formValue = $('macroscopicPortalInvasion').getValue();
		var dbVarName = 'PathologicalData_PortalVein_MacroscopicInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
	}

	// MICROSCOPIC PORTAL INVASION
	if (changedModalities.indexOf('microscopicPortalInvasion') != -1) {
		var formValue = $('microscopicPortalInvasion').getValue();
		var dbVarName = 'PathologicalData_PortalVein_MicroscopicInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// NODULE SIZE LARGEST AXIS
	if (changedModalities.indexOf('noduleSizeLargestAxis') != -1) {
		var formValue = $('noduleSizeLargestAxis').getValue().trim();
		var dbVarName = 'PathologicalData_NoduleSizeLargestAxis';
		newModalities.set(dbVarName, formValue);
	}

	// SURGICAL MARGIN
	if (changedModalities.indexOf('surgicalMargin') != -1) {
		var formValue = $('surgicalMargin').getValue().trim();
		var dbVarName = 'PathologicalData_SurgicalMargin';
		newModalities.set(dbVarName, formValue);
	}

	// EDMONSON GRADE
	if (changedModalities.indexOf('edmonsonGrade') != -1) {
		var formValue = $('edmonsonGrade').getValue();
		var dbVarName = 'PathologicalData_EdmonsonGrade';
		if (formValue == 'IV')
			newModalities.set(dbVarName, 'IV');
		else if (formValue == 'III')
			newModalities.set(dbVarName, 'III');
		else if (formValue == 'II')
			newModalities.set(dbVarName, 'II');
		else if (formValue == 'I')
			newModalities.set(dbVarName, 'I');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// DIFFERENCIATION WHO
	if (changedModalities.indexOf('differenciationWHO') != -1) {
		var formValue = $('differenciationWHO').getValue();
		var dbVarName = 'PathologicalData_Differenciation_WHO';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// HISTOLOGICAL PATTERN
	if (changedModalities.indexOf('histologicalPattern') != -1) {
		var formOptions = $('histologicalPattern').options;
		if (formOptions[0].selected == true)
			newModalities.set('PathologicalData_HistologicalPattern_Microtrabecular', 'TRUE');
		else
			newModalities.set('PathologicalData_HistologicalPattern_Microtrabecular', 'NULL');

		if (formOptions[1].selected == true)
			newModalities.set('PathologicalData_HistologicalPattern_Macrotrabecular', 'TRUE');
		else
			newModalities.set('PathologicalData_HistologicalPattern_Macrotrabecular', 'NULL');

		if (formOptions[2].selected == true)
			newModalities.set('PathologicalData_HistologicalPattern_Pseudoglandular', 'TRUE');
		else
			newModalities.set('PathologicalData_HistologicalPattern_Pseudoglandular', 'NULL');

		if (formOptions[3].selected == true)
			newModalities.set('PathologicalData_HistologicalPattern_Compact', 'TRUE');
		else
			newModalities.set('PathologicalData_HistologicalPattern_Compact', 'NULL');

		if (formOptions[4].selected == true)
			newModalities.set('PathologicalData_HistologicalPattern_Diffused', 'TRUE');
		else
			newModalities.set('PathologicalData_HistologicalPattern_Diffused', 'NULL');

		if (formOptions[5].selected == true)
			newModalities.set('PathologicalData_HistologicalPattern_Scirrhous', 'TRUE');
		else
			newModalities.set('PathologicalData_HistologicalPattern_Scirrhous', 'NULL');
	}

	// DEGREE OF NUCLEAR ATYPIA
	if (changedModalities.indexOf('nuclearAtypiaDegree') != -1) {
		var formValue = $('nuclearAtypiaDegree').getValue();
		var dbVarName = 'PathologicalData_NuclearAtypiaDegree';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// INTRANUCLEAR INCLUSIONS
	if (changedModalities.indexOf('intranuclearInclusion') != -1) {
		var formValue = $('intranuclearInclusion').getValue();
		var dbVarName = 'PathologicalData_IntranuclearInclusions';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// CLEAR CELLS
	if (changedModalities.indexOf('clearCells') != -1) {
		var formValue = $('clearCells').getValue();
		var dbVarName = 'PathologicalData_ClearCells';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// EOSINOPHILIC INCLUSIONS
	if (changedModalities.indexOf('eosinophilicInclusions') != -1) {
		var formValue = $('eosinophilicInclusions').getValue();
		var dbVarName = 'PathologicalData_EosinophilicInclusions';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// SARCOMATOID APPEARANCE
	if (changedModalities.indexOf('sarcomatoidAppearance') != -1) {
		var formValue = $('sarcomatoidAppearance').getValue();
		var dbVarName = 'PathologicalData_SarcomatoidAppearance';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// OSTEOCLAST LIKE CELLS
	if (changedModalities.indexOf('osteoclastLikeCells') != -1) {
		var formValue = $('osteoclastLikeCells').getValue();
		var dbVarName = 'PathologicalData_OsteoclastLikeCells';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// ONCOCYTIC CELLS
	if (changedModalities.indexOf('oncocyticCells') != -1) {
		var formValue = $('oncocyticCells').getValue();
		var dbVarName = 'PathologicalData_OncocyticCells';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// TUMORAL CHOLESTASIS
	if (changedModalities.indexOf('tumoralCholestasis') != -1) {
		var formValue = $('tumoralCholestasis').getValue();
		var dbVarName = 'PathologicalData_TumoralCholestasis';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			;
	}

	// FIBROTIC STROMA
	if (changedModalities.indexOf('fibroticStroma') != -1) {
		var formValue = $('fibroticStroma').getValue();
		var dbVarName = 'PathologicalData_FibroticStroma';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// INFLAMMATION
	if (changedModalities.indexOf('inflammation') != -1) {
		var formValue = $('inflammation').getValue();
		var dbVarName = 'PathologicalData_Inflammation';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// INFLAMMATION TYPE
	if (changedModalities.indexOf('inflammationType') != -1) {
		var formValue = $('inflammationType').getValue();
		var dbVarName = 'PathologicalData_InflammationType';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// PELIOSIS / HEMORRHAGE
	if (changedModalities.indexOf('peliosisHemorrhage') != -1) {
		var formValue = $('peliosisHemorrhage').getValue();
		var dbVarName = 'PathologicalData_PeliosisHemorrhage';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// PERINEURAL INVASION
	if (changedModalities.indexOf('perineuralInvasion') != -1) {
		var formValue = $('perineuralInvasion').getValue();
		var dbVarName = 'PathologicalData_PerineuralInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// BILIARY INVASION
	if (changedModalities.indexOf('biliaryInvasion') != -1) {
		var formValue = $('biliaryInvasion').getValue();
		var dbVarName = 'PathologicalData_BiliaryTractInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// TUMORAL CAPSULE
	if (changedModalities.indexOf('tumoralCapsule') != -1) {
		var formValue = $('tumoralCapsule').getValue();
		var dbVarName = 'PathologicalData_TumoralCapsule';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// GLISSON CAPSULE INVASION
	if (changedModalities.indexOf('glissonCapsuleInvasion') != -1) {
		var formValue = $('glissonCapsuleInvasion').getValue();
		var dbVarName = 'PathologicalData_GlissonCapsuleInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// EXTRA_HEPATIC TISSUE INVASION
	if (changedModalities.indexOf('extraHepaticInvasion') != -1) {
		var formValue = $('extraHepaticInvasion').getValue();
		var dbVarName = 'PathologicalData_ExtraHepaticInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// EXTRA HEPATIC TISSUE INVASION -- TISSUE
	if (changedModalities.indexOf('extraHepaticInvasionTissue') != -1) {
		var formOptions = $('extraHepaticInvasionTissue').options;
		if (formOptions[0].selected == true)
			newModalities.set('PathologicalData_ExtraHepaticInvasion_AbdominalCavity', 'TRUE');
		else
			newModalities.set('PathologicalData_ExtraHepaticInvasion_AbdominalCavity', 'NULL');

		if (formOptions[1].selected == true)
			newModalities.set('PathologicalData_ExtraHepaticInvasion_AdiposeTissue', 'TRUE');
		else
			newModalities.set('PathologicalData_ExtraHepaticInvasion_AdiposeTissue', 'NULL');

		if (formOptions[2].selected == true)
			newModalities.set('PathologicalData_ExtraHepaticInvasion_AdrenalGland', 'TRUE');
		else
			newModalities.set('PathologicalData_ExtraHepaticInvasion_AdrenalGland', 'NULL');

		if (formOptions[3].selected == true)
			newModalities.set('PathologicalData_ExtraHepaticInvasion_GallBladder', 'TRUE');
		else
			newModalities.set('PathologicalData_ExtraHepaticInvasion_GallBladder', 'NULL');

		if (formOptions[4].selected == true)
			newModalities
					.set('PathologicalData_ExtraHepaticInvasion_GallBladderAdventitia', 'TRUE');
		else
			newModalities
					.set('PathologicalData_ExtraHepaticInvasion_GallBladderAdventitia', 'NULL');

		if (formOptions[5].selected == true)
			newModalities.set('PathologicalData_ExtraHepaticInvasion_Peritoneum', 'TRUE');
		else
			newModalities.set('PathologicalData_ExtraHepaticInvasion_Peritoneum', 'NULL');
	}

	// NECROSIS
	if (changedModalities.indexOf('necrosis') != -1) {
		var formValue = $('necrosis').getValue().trim();
		var dbVarName = 'PathologicalData_Necrosis';
		newModalities.set(dbVarName, formValue);
	}

	// TUMORAL STEATOSIS
	if (changedModalities.indexOf('tumoralSteatosis') != -1) {
		var formValue = $('tumoralSteatosis').getValue();
		var dbVarName = 'PathologicalData_TumoralSteatosis';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// HEPATIC VEIN INVASION
	if (changedModalities.indexOf('hepaticVeinInvasion') != -1) {
		var formValue = $('hepaticVeinInvasion').getValue();
		var dbVarName = 'PathologicalData_HepaticVeinInvasion';
		if (formValue == 'NA')
			newModalities.set(dbVarName, 'NA');
		else if (formValue == 'YES')
			newModalities.set(dbVarName, 'TRUE');
		else if (formValue == 'NO')
			newModalities.set(dbVarName, 'FALSE');
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// MISC PATHOLOGICAL DATA
	if (changedModalities.indexOf('miscellaneousPathologicalData') != -1) {
		var formValue = $('miscellaneousPathologicalData').getValue().trim();
		var dbVarName = 'PathologicalData_MiscallenousInfo';
		newModalities.set(dbVarName, formValue);
	}

	// LARGEST NODULE DIAMETER
	if (changedModalities.indexOf('largestNoduleDiameter') != -1)
		newModalities.set("PathologicalData_LargestNoduleDiameter", $('largestNoduleDiameter')
				.getValue().trim());

	// ---------- IMMUNO HISTO CHEMISTRY ---------- //

	// IHC BCAT MEMBRANE
	if (changedModalities.indexOf('ihcBCATmembrane') != -1) {
		var formValue = $('ihcBCATmembrane').getValue();
		var dbVarName = 'IHCData_Tumor_BCATMembrane';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC BCAT CYTOPLASM
	if (changedModalities.indexOf('ihcBCATcytoplasm') != -1) {
		var formValue = $('ihcBCATcytoplasm').getValue();
		var dbVarName = 'IHCData_Tumor_BCATCytoplasm';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC BCAT NUCLEUS
	if (changedModalities.indexOf('ihcBCATnucleus') != -1) {
		var formValue = $('ihcBCATnucleus').getValue();
		var dbVarName = 'IHCData_Tumor_BCATNucleus';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC CK19 TUMOR
	if (changedModalities.indexOf('ihcCK19Tumor') != -1) {
		var formOptions = $('ihcCK19Tumor').options;
		var dbVarName = 'IHCData_Tumor_CK19';
		if (formOptions[0].selected == true)
			newModalities.set(dbVarName, '0-1');
		else if (formOptions[1].selected == true)
			newModalities.set(dbVarName, '2');
		else if (formOptions[2].selected == true)
			newModalities.set(dbVarName, '3');
		else if (formOptions[3].selected == true)
			newModalities.set(dbVarName, 'NULL');
		else if (formOptions[4].selected == true)
			newModalities.set(dbVarName, 'NA');
	}

	// IHC EPCAM TUMOR
	if (changedModalities.indexOf('ihcEPCAMTumor') != -1) {
		var formOptions = $('ihcEPCAMTumor').options;
		var dbVarName = 'IHCData_Tumor_EPCAM';
		if (formOptions[0].selected == true)
			newModalities.set(dbVarName, '0-1');
		else if (formOptions[1].selected == true)
			newModalities.set(dbVarName, '2');
		else if (formOptions[2].selected == true)
			newModalities.set(dbVarName, '3');
		else if (formOptions[3].selected == true)
			newModalities.set(dbVarName, 'NULL');
		else if (formOptions[4].selected == true)
			newModalities.set(dbVarName, 'NA');
	}

	// IHC GS LOCALIZATION
	if (changedModalities.indexOf('ihcGSlocalization') != -1) {
		var formValue = $('ihcGSlocalization').getValue();
		var dbVarName = 'IHCData_Tumor_GSLocalization';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC GS INTENSITY
	if (changedModalities.indexOf('ihcGSintensity') != -1) {
		var formValue = $('ihcGSintensity').getValue();
		var dbVarName = 'IHCData_Tumor_GSIntensity';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC ADRENOMEDULIN TUMOR
	if (changedModalities.indexOf('ihcAdrenomedulinTumor') != -1) {
		var formValue = $('ihcAdrenomedulinTumor').getValue();
		var dbVarName = 'IHCData_Tumor_Adrenomedulin';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC ADRENOMEDULIN NT LIVER
	if (changedModalities.indexOf('ihcAdrenomedulinNTLiver') != -1) {
		var formValue = $('ihcAdrenomedulinNTLiver').getValue();
		var dbVarName = 'IHCData_NTLiver_Adrenomedulin';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC RAMP3 TUMOR
	if (changedModalities.indexOf('ihcRAMP3Tumor') != -1) {
		var formValue = $('ihcRAMP3Tumor').getValue();
		var dbVarName = 'IHCData_Tumor_RAMP3';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// IHC RAMP3 NT LIVER
	if (changedModalities.indexOf('ihcRAMP3NTLiver') != -1) {
		var formValue = $('ihcRAMP3NTLiver').getValue();
		var dbVarName = 'IHCData_NTLiver_RAMP3';
		if (formValue != '-')
			newModalities.set(dbVarName, formValue);
		else if (formValue == '-')
			newModalities.set(dbVarName, 'NULL');
	}

	// ---------- SAVING VARIABLES WITH GENERIC INPUT ---------- //

	var eavData = $H(currentTissue.eavData);

	// generic variables WITH previous modality for current tissue
	for ( var i = 0; i < eavData.keys().size(); i++) {
		var varName = eavData.keys()[i];
		if (variablesWithCustomInput.indexOf(varName) == -1 && !eavData.get(varName).deprecated
				&& changedModalities.indexOf(varName) != -1) {
			newModalities.set(varName, $(varName).getValue());
		}
	}

	// generic variables WITHOUT previous modality for current tissue
	for ( var i = 0; i < currentTissueUnsetGenericVariables.size(); i++) {
		var variable = currentTissueUnsetGenericVariables[i];
		var varName = variable.variableName;
		if (variablesWithCustomInput.indexOf(varName) == -1 && !variable.deprecated
				&& changedModalities.indexOf(varName) != -1) {
			newModalities.set(varName, $(varName).getValue());
		}
	}

	var newModalitiesJSON = Object.toJSON(newModalities);
	new Ajax.Request('mainServlet', {
		method : 'POST',
		parameters : {
			appAction : 'ajaxUpdateTissueModalities',
			newModalities : newModalitiesJSON
		}
	});

}

// ------------------------------------- LOAD TISSUE
// ------------------------------------- //

function loadTissue(chcID, tissueTypeID) {
	$('tissueDataForm').reset();
	changedModalities.clear();
	initForm();
	variablesWithCustomInput.clear();
	new Ajax.Request(
			'mainServlet',
			{
				method : 'POST',
				parameters : {
					appAction : 'ajaxLoadTissue',
					chcID : chcID,
					tissueTypeID : tissueTypeID
				},
				onSuccess : function(transport) {

					var tissue = transport.responseText.evalJSON();
					currentTissue = tissue;

					$('chcIDcurrentTissue').update(tissue.chcID);
					$('tissueTypeIDcurrentTissue').update(tissue.tissueTypeID);

					// ---------- TISSUE INFO ---------- //

					// QUANTITY TISSUE LEFT
					if (tissue.quantityLeft != null)
						$('quantityLeft').update(tissue.quantityLeft);

					// SIMPLE DIAGNOSIS
					if (tissue.eavData.Diagnosis_B_Benign_M_Malignant_NT_Non_tumoral != null) {
						var mod = tissue.eavData.Diagnosis_B_Benign_M_Malignant_NT_Non_tumoral.modality;
						if (mod.toUpperCase() == 'B' || mod.toUpperCase() == 'BENIGN')
							$('simpleDiagnosis').setValue('Benign');
						else if (mod.toUpperCase() == 'M' || mod.toUpperCase() == 'MALIGNANT')
							$('simpleDiagnosis').setValue('Malignant');
						else if (mod.toUpperCase() == 'L' || mod.toUpperCase() == 'CELL LINE')
							$('simpleDiagnosis').setValue('Cell Line');
						else if (mod.toUpperCase() == 'NT' || mod.toUpperCase() == 'NON TUMORAL')
							$('simpleDiagnosis').setValue('Non Tumoral');
						else if (mod.toUpperCase() == 'NA')
							$('simpleDiagnosis').setValue('NA');
						else
							$('simpleDiagnosis').setValue('-');
					}
					variablesWithCustomInput.push('Diagnosis_B_Benign_M_Malignant_NT_Non_tumoral');

					// SAMPLE ORIGIN
					if (tissue.eavData.MiscData_TissueSampleOrigin != null) {
						var upMod = tissue.eavData.MiscData_TissueSampleOrigin.modality
								.toUpperCase();
						if (upMod == 'SURGERY')
							$('sampleType').setValue('Surgery');
						else if (upMod == 'Biopsy')
							$('sampleType').setValue('Biopsy');
						else if (upMod == 'BOTH')
							$('sampleType').setValue('Both');
						else if (upMod == 'NA')
							$('sampleType').setValue('NA');
					}
					variablesWithCustomInput.push('MiscData_TissueSampleOrigin');

					// ASSOCIATED TISSUES
					var associatedTissuesString = '';
					if (tissue.associatedTissues != null && tissue.associatedTissues.size() > 0) {
						for ( var i = 0; i < tissue.associatedTissues.size(); i++) {

							var at = new Tissue(tissue.associatedTissues[i]);
							associatedTissuesString += at.toButton() + '&nbsp;&nbsp;&nbsp;';
							// associatedTissuesString += '<input
							// type=\'button\' value=\'X\'>';
							// associatedTissuesString += '&nbsp;&nbsp;&nbsp;';
						}

					}
					else {
						associatedTissuesString = "NONE";
					}
					// associatedTissuesString+='&nbsp;<input style=\'float:
					// right\' type=\'button\' value=\'Add associated
					// Tissue\'/>';
					$('associatedTissuesDiv').update(associatedTissuesString);

					// MASTER TISSUE
					var t = new Tissue(tissue);
					if (t.hasMasterTissue()) {
						var masterTissueButtons = t.getMasterTissue().toButton();
						masterTissueButtons += '<input type=\'button\' value=\'X\' '
								+ ' onClick=\"removeMasterTissue(' + t.chcID + ',\''
								+ t.tissueTypeID + '\',' + t.getMasterTissue().chcID + ',\''
								+ t.getMasterTissue().tissueTypeID + '\');\">';
						$('masterTissueDiv').update(masterTissueButtons);
					}
					else if (tissue.associatedTissues.size() > 0)
						$('masterTissueDiv').update("This tissue is a Master Tissue");
					else {
						var nonMasterTissueButton = 'NONE&nbsp;&nbsp;&nbsp;';
						nonMasterTissueButton += '<input type=\'button\' '
								+ 'value=\'associate to Master Tissue\' '
								+ 'onClick=\"$(\'newMasterTissueDiv\').show();\" />';

						$('masterTissueDiv').update(nonMasterTissueButton);
					}

					// ---------- CLINICAL DATA ---------- //

					// CLINICAL CENTER
					if (tissue.eavData.ClinicalData_ClinicalCenter != null)
						$('clinicalCenter').setValue(
								tissue.eavData.ClinicalData_ClinicalCenter.modality);
					variablesWithCustomInput.push('ClinicalData_ClinicalCenter');

					// RECEPTION DATE
					if (tissue.eavData.ClinicalData_ReceptionDate != null)
						$('receptionDate').setValue(
								tissue.eavData.ClinicalData_ReceptionDate.modality);
					variablesWithCustomInput.push('ClinicalData_ReceptionDate');

					// ANAPATH ID
					if (tissue.eavData.ClinicalData_AnapathID != null)
						$('anapathID').setValue(tissue.eavData.ClinicalData_AnapathID.modality);
					variablesWithCustomInput.push('ClinicalData_AnapathID');

					// FIRST NAME
					if (tissue.eavData.ClinicalData_FirstName != null)
						$('firstName').setValue(tissue.eavData.ClinicalData_FirstName.modality);
					variablesWithCustomInput.push('ClinicalData_FirstName');

					// SEX
					if (tissue.eavData.ClinicalData_Sex != null) {
						if (tissue.eavData.ClinicalData_Sex.modality.toUpperCase() == "M")
							$('sex').setValue('M');
						else if (tissue.eavData.ClinicalData_Sex.modality.toUpperCase() == "F") {
							$('sex').setValue('F');
							$('nChildren').enable();
							$('ageMenopause').enable();
							$('oralContraception').enable();
						}
						else if (tissue.eavData.ClinicalData_Sex.modality.toUpperCase() == "NA")
							$('sex').setValue('NA');
						else
							$('sex').setValue('-');
					}
					variablesWithCustomInput.push('ClinicalData_Sex');

					// AGE
					if (tissue.eavData.ClinicalData_Age != null)
						$('age').setValue(tissue.eavData.ClinicalData_Age.modality);
					variablesWithCustomInput.push('ClinicalData_Age');

					// DATE OF BIRTH
					if (tissue.eavData.ClinicalData_BirthDate != null)
						$('birthDate').setValue(tissue.eavData.ClinicalData_BirthDate.modality);
					variablesWithCustomInput.push('ClinicalData_BirthDate');

					// PLACE OF BIRTH
					if (tissue.eavData.ClinicalData_BirthPlace != null)
						$('placeOfBirth').setValue(tissue.eavData.ClinicalData_BirthPlace.modality);
					variablesWithCustomInput.push('ClinicalData_BirthPlace');

					// NUMBER OF CHILDREN
					if (tissue.eavData.ClinicalData_nbChildren != null)
						$('nChildren').setValue(tissue.eavData.ClinicalData_nbChildren.modality);
					variablesWithCustomInput.push('ClinicalData_nbChildren');

					// AGE AT MENOPAUSE
					if (tissue.eavData.ClinicalData_AgeMenopause != null)
						$('ageMenopause').setValue(
								tissue.eavData.ClinicalData_AgeMenopause.modality);
					variablesWithCustomInput.push('ClinicalData_AgeMenopause');

					// PROFESSION
					if (tissue.eavData.ClinicalData_Profession != null)
						$('profession').setValue(tissue.eavData.ClinicalData_Profession.modality);
					variablesWithCustomInput.push('ClinicalData_Profession');

					// SURGERY DATE
					if (tissue.eavData.ClinicalData_SurgeryDate != null)
						$('surgeryDate').setValue(tissue.eavData.ClinicalData_SurgeryDate.modality);
					variablesWithCustomInput.push('ClinicalData_SurgeryDate');

					// PRE-SURGERY TREATMENT
					if (tissue.eavData.ClinicalData_PreSurgeryTreatment != null) {
						var upMod = tissue.eavData.ClinicalData_PreSurgeryTreatment.modality
								.toUpperCase();
						if (upMod == 'YES' || upMod == 'NO' || upMod == 'NA') {
							$('preSurgeryTreatment').setValue(upMod);
							if (upMod == 'YES')
								$('preSurgeryTreatmentDetail').enable();
						}
						else if (upMod == 'OUI' || upMod == 'TRUE') {
							$('preSurgeryTreatment').setValue('YES');
							$('preSurgeryTreatmentDetail').enable();
						}
						else if (upMod == 'NON' || upMod == 'FALSE')
							$('preSurgeryTreatment').setValue('NO');
					}
					variablesWithCustomInput.push('ClinicalData_PreSurgeryTreatment');

					// PRE-SURGERY TREATMENT TYPE - CHEMOEMBOLIZATION
					var isND = true;
					if (tissue.eavData.ClinicalData_PreSurgeryTreatment_HepaticTranplantation != null) {
						var upMod = tissue.eavData.ClinicalData_PreSurgeryTreatment_HepaticTranplantation.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('preSurgeryTreatmentDetail').options[0].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.ClinicalData_PreSurgeryTreatment_Hepatectomy != null) {
						var upMod = tissue.eavData.ClinicalData_PreSurgeryTreatment_Hepatectomy.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('preSurgeryTreatmentDetail').options[1].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.ClinicalData_PreSurgeryTreatment_Chemotherapy != null) {
						var upMod = tissue.eavData.ClinicalData_PreSurgeryTreatment_Chemotherapy.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('preSurgeryTreatmentDetail').options[2].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.ClinicalData_PreSurgeryTreatment_Chemoembolization != null) {
						var upMod = tissue.eavData.ClinicalData_PreSurgeryTreatment_Chemoembolization.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('preSurgeryTreatmentDetail').options[3].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.ClinicalData_PreSurgeryTreatment_Other != null) {
						var mod = tissue.eavData.ClinicalData_PreSurgeryTreatment_Other.modality;
						var upMod = mod.toUpperCase();
						if (upMod != 'FALSE' && upMod != 'NULL' && upMod != 'NON' && upMod != 'NO') {
							$('preSurgeryTreatmentDetail').options[4].selected = true;
							isND = false;
							$('preSurgeryTreatmentDetailOther').enable();
							$('preSurgeryTreatmentDetailOther').update(mod);
						}
					}
					if (!isND) {
						$('preSurgeryTreatmentDetail').enable();
						$('preSurgeryTreatmentDetail').options[5].selected = false;
					}
					variablesWithCustomInput
							.push('ClinicalData_PreSurgeryTreatment_HepaticTranplantation');
					variablesWithCustomInput.push('ClinicalData_PreSurgeryTreatment_Hepatectomy');
					variablesWithCustomInput.push('ClinicalData_PreSurgeryTreatment_Chemotherapy');
					variablesWithCustomInput
							.push('ClinicalData_PreSurgeryTreatment_Chemoembolization');
					variablesWithCustomInput.push('ClinicalData_PreSurgeryTreatment_Other');

					// ---------- BIOLOGICAL DATA ---------- //

					// ALPHAFOETO
					if (tissue.eavData.BiologicalData_Alphafoeto != null)
						$('alphaFoeto').setValue(tissue.eavData.BiologicalData_Alphafoeto.modality);
					variablesWithCustomInput.push('BiologicalData_Alphafoeto');

					// BILLIRUBIN
					if (tissue.eavData.BiologicalData_Billirubin != null)
						$('billirubin').setValue(tissue.eavData.BiologicalData_Billirubin.modality);
					variablesWithCustomInput.push('BiologicalData_Billirubin');

					// ALBUMIN
					if (tissue.eavData.BiologicalData_Albumin != null)
						$('albumin').setValue(tissue.eavData.BiologicalData_Albumin.modality);
					variablesWithCustomInput.push('BiologicalData_Albumin');

					// TP
					if (tissue.eavData.BiologicalData_TP != null)
						$('tp').setValue(tissue.eavData.BiologicalData_TP.modality);
					variablesWithCustomInput.push('BiologicalData_TP');

					// CHILD-PUGH
					if (tissue.eavData.BiologicalData_ChildPugh != null) {
						if (tissue.eavData.BiologicalData_ChildPugh.modality.toUpperCase() == 'A')
							$('childPugh').setValue('A');
						else if (tissue.eavData.BiologicalData_ChildPugh.modality.toUpperCase() == 'B')
							$('childPugh').setValue('B');
						else if (tissue.eavData.BiologicalData_ChildPugh.modality.toUpperCase() == 'C')
							$('childPugh').setValue('C');
						else
							$('childPugh').setValue('-');
					}
					variablesWithCustomInput.push('BiologicalData_ChildPugh');

					// ASCITES
					if (tissue.eavData.BiologicalData_Ascites != null) {
						if (tissue.eavData.BiologicalData_Ascites.modality.toUpperCase() == 'YES'
								|| tissue.eavData.BiologicalData_Ascites.modality.toUpperCase() == 'OUI'
								|| tissue.eavData.BiologicalData_Ascites.modality.toUpperCase() == 'TRUE')
							$('ascites').setValue('YES');
						else if (tissue.eavData.BiologicalData_Ascites.modality.toUpperCase() == 'NO'
								|| tissue.eavData.BiologicalData_Ascites.modality.toUpperCase() == 'NON'
								|| tissue.eavData.BiologicalData_Ascites.modality.toUpperCase() == 'FALSE')
							$('ascites').setValue('NO');
						else
							$('ascites').setValue('-');
					}
					variablesWithCustomInput.push('BiologicalData_Ascites');

					// ---------- NT LIVER DATA ---------- //

					// NORMAL LIVER HISTOLOGY
					if (tissue.eavData.NTLiver_Histology != null) {
						if (tissue.eavData.NTLiver_Histology.modality.toUpperCase().indexOf("CIRR") != -1) {
							$('normalLiverHistology').setValue('Cirrhosis');
						}
						else if (tissue.eavData.NTLiver_Histology.modality.toUpperCase() == "HCA")
							$('normalLiverHistology').setValue('Chronic Active Hepatitis');
						else if (tissue.eavData.NTLiver_Histology.modality.toUpperCase() == "FP")
							$('normalLiverHistology').setValue('Portal Fibrosis');
						else if (tissue.eavData.NTLiver_Histology.modality.toUpperCase() == "FN")
							$('normalLiverHistology').setValue('Normal Liver');
						else if (tissue.eavData.NTLiver_Histology.modality.toUpperCase() == "SHP")
							$('normalLiverHistology').setValue('Hepatoportal Sclerosis');
						else
							$('normalLiverHistology').setValue('-');
					}
					checkCirrhosis();
					variablesWithCustomInput.push('NTLiver_Histology');

					// MACRO/MICRO NODULAR CIRRHOSIS
					if (tissue.eavData.NTLiver_CirrhosisType != null) {
						var mod = tissue.eavData.NTLiver_CirrhosisType.modality;

						if (mod.toUpperCase().indexOf('MACRO') != -1)
							$('macronodularCirrhosis').setValue(true);
						else if (mod.toUpperCase().indexOf('MICRO') != -1)
							$('micronodularCirrhosis').setValue(true);
						else if (mod.toUpperCase().indexOf('BOTH') != -1
								|| mod.toUpperCase().indexOf('MIX') != -1) {
							$('micronodularCirrhosis').setValue(true);
							$('macronodularCirrhosis').setValue(true);
						}
					}
					variablesWithCustomInput.push('NTLiver_CirrhosisType');

					// METAVIR ACTIVITY
					if (tissue.eavData.NTLiver_MetavirActivity != null) {
						var mod = tissue.eavData.NTLiver_MetavirActivity.modality;
						if (mod.indexOf('0') != -1)
							$('AMetavir').setValue('A0');
						else if (mod.indexOf('1') != -1)
							$('AMetavir').setValue('A1');
						else if (mod.indexOf('2') != -1)
							$('AMetavir').setValue('A2');
						else if (mod.indexOf('3') != -1)
							$('AMetavir').setValue('A3');
						else
							$('AMetavir').setValue('-');
					}
					variablesWithCustomInput.push('NTLiver_MetavirActivity');

					// METAVIR FIBROSIS
					if (tissue.eavData.NTLiver_MetavirFibrosis != null) {
						var upMod = tissue.eavData.NTLiver_MetavirFibrosis.modality.toUpperCase();
						if (upMod.indexOf('0') != -1)
							$('FMetavir').setValue('F0');
						else if (upMod.indexOf('1') != -1)
							$('FMetavir').setValue('F1');
						else if (upMod.indexOf('2') != -1)
							$('FMetavir').setValue('F2');
						else if (upMod.indexOf('3') != -1)
							$('FMetavir').setValue('F3');
						else if (upMod.indexOf('4') != -1)
							$('FMetavir').setValue('F4');
						else if (upMod == 'NA')
							$('FMetavir').setValue('NA');
						else
							$('FMetavir').setValue('-');
					}
					variablesWithCustomInput.push('NTLiver_MetavirFibrosis');

					// IRON OVERLOAD
					if (tissue.eavData.NTLiver_IronOverloadSearle_Degree != null) {
						var mod = tissue.eavData.NTLiver_IronOverloadSearle_Degree.modality;
						if (mod == 1 || mod == 2 || mod == 3 || mod == 4 || mod == 0
								|| mod.toUpperCase() == 'NA')
							$('ironOverloadValue').setValue(mod);
						else
							$('ironOverloadValue').setValue('-');
					}
					variablesWithCustomInput.push('NTLiver_IronOverloadSearle_Degree');

					// NT STEATOSIS
					if (tissue.eavData.NTLiver_Steatosis != null) {
						var mod = tissue.eavData.NTLiver_Steatosis.modality;
						if (mod == 1 || mod == 2 || mod == 3 || mod == 4 || mod == 0
								|| mod.toUpperCase() == 'NA')
							$('ntSteatosis').setValue(mod);
					}
					variablesWithCustomInput.push('NTLiver_Steatosis');

					// HEPATOCYTIC DYSPLASIA
					if (tissue.eavData.NTLiver_HepatocyticDysplasia != null) {
						var mod = tissue.eavData.NTLiver_HepatocyticDysplasia.modality;
						if (mod.toUpperCase().indexOf('PC/GC') != -1
								|| mod.toUpperCase().indexOf('BOTH') != -1)
							$('hepatocyticDysplasia').setValue('Both');
						else if (mod.toUpperCase().indexOf('GC') != -1
								|| mod.toUpperCase().indexOf('LARGE CELLS') != -1)
							$('hepatocyticDysplasia').setValue('Large cells');
						else if (mod.toUpperCase().indexOf('PC') != -1
								|| mod.toUpperCase().indexOf('SMALL CELLS') != -1)
							$('hepatocyticDysplasia').setValue('Small cells');
						else if (mod.toUpperCase().indexOf('NON') != -1
								|| mod.toUpperCase() == 'FALSE')
							$('hepatocyticDysplasia').setValue('None');
						else if (mod.toUpperCase() == 'NA')
							$('hepatocyticDysplasia').setValue('NA');
						else
							$('hepatocyticDysplasia').setValue('-');
					}
					variablesWithCustomInput.push('NTLiver_HepatocyticDysplasia');

					// ASSOCIATED TUMORS
					if (tissue.eavData.NTLiver_AssociatedTumor != null) {
						var upMod = tissue.eavData.NTLiver_AssociatedTumor.modality.toUpperCase();
						if (upMod == 'ADENOMA') {
							$('associatedTumor').setValue('Adenoma');
						}
						else if (upMod == 'ANGIOMA') {
							$('associatedTumor').setValue('Angioma');
						}
						else if (upMod == 'FNH') {
							$('associatedTumor').setValue('FNH');
						}
						else if (upMod == 'HNR') {
							$('associatedTumor').setValue('HNR');
						}
						else if (upMod == 'NA') {
							$('associatedTumor').setValue('NA');
						}
					}
					variablesWithCustomInput.push('NTLiver_AssociatedTumor');

					// OTHER LESIONS
					if (tissue.eavData.NTLiver_OtherLesions != null) {
						var mod = tissue.eavData.NTLiver_OtherLesions.modality;
						if (mod.toUpperCase().indexOf('MEYENBURG') != -1)
							$('otherLesions').setValue('Von Meyenburg complexes');
						else if (mod.toUpperCase().indexOf('GLYCOGENIC FOCI') != -1)
							$('otherLesions').setValue('Glycogenic foci');
						else if (mod.toUpperCase().indexOf('PELIOSIS') != -1)
							$('otherLesions').setValue('Peliosis');
						else if (mod.toUpperCase().indexOf('BILIARY ADENOMA') != -1)
							$('otherLesions').setValue('Biliary adenoma');
						else if (mod.toUpperCase() == 'NA')
							$('otherLesions').setValue('NA');
						else {
							$('otherLesions').setValue('Other');
							$('otherLesionsMisc').show();
							$('otherLesionsMisc').enable();
							$('otherLesionsMisc').setValue(mod);
						}
					}
					variablesWithCustomInput.push('NTLiver_OtherLesions');

					// ---------- RISK FACTORS ---------- //

					// HBV
					if (tissue.eavData.RiskFactors_HBV_status != null) {
						if (tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "OUI"
								|| tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "TRUE"
								|| tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "YES")
							$('hbv').setValue('YES');
						else if (tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "NON"
								|| tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "FALSE"
								|| tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "NO")
							$('hbv').setValue('NO');
						else if (tissue.eavData.RiskFactors_HBV_status.modality.toUpperCase() == "NA")
							$('hbv').setValue('NA');
						else
							$('hbv').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HBV_status');

					// HCV
					if (tissue.eavData.RiskFactors_HCV_status != null) {
						if (tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "OUI"
								|| tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "TRUE"
								|| tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "YES")
							$('hcv').setValue('YES');
						else if (tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "NON"
								|| tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "FALSE"
								|| tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "NO")
							$('hcv').setValue('NO');
						else if (tissue.eavData.RiskFactors_HCV_status.modality.toUpperCase() == "NA")
							$('hcv').setValue('NA');
						else
							$('hcv').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HCV_status');

					// AGHBS
					if (tissue.eavData.RiskFactors_HBV_AgHBs != null) {
						var mod = tissue.eavData.RiskFactors_HBV_AgHBs.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('agHBs').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('agHBs').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('agHBs').setValue('NA');
						else
							$('agHBs').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HBV_AgHBs');

					// ACHBC
					if (tissue.eavData.RiskFactors_HBV_AcHBc != null) {
						var mod = tissue.eavData.RiskFactors_HBV_AcHBc.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('acHBc').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('acHBc').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('acHBc').setValue('NA');
						else
							$('acHBc').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HBV_AcHBc');

					// HBV VIRAL DNA
					if (tissue.eavData.RiskFactors_HBV_ViralDNA != null) {
						var mod = tissue.eavData.RiskFactors_HBV_ViralDNA.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('hbvViralDNA').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('hbvViralDNA').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('hbvViralDNA').setValue('NA');
						else
							$('hbvViralDNA').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HBV_ViralDNA');

					// PCR HBX NON TUMORAL LIVER
					if (tissue.eavData.RiskFactors_PCR_HBX_NTLiver != null) {
						var mod = tissue.eavData.RiskFactors_PCR_HBX_NTLiver.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('pcrHBXNTLiver').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('pcrHBXNTLiver').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('pcrHBXNTLiver').setValue('NA');
						else
							$('pcrHBXNTLiver').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_PCR_HBX_NTLiver');

					// PCR HBX TUMORAL LIVER
					if (tissue.eavData.RiskFactors_PCR_HBX_TLiver != null) {
						var mod = tissue.eavData.RiskFactors_PCR_HBX_TLiver.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('pcrHBXTLiver').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('pcrHBXTLiver').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('pcrHBXTLiver').setValue('NA');
						else
							$('pcrHBXTLiver').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_PCR_HBX_TLiver');

					// HBV HISTOCHEMISTRY
					if (tissue.eavData.RiskFactors_HBV_Histochemistry != null) {
						var mod = tissue.eavData.RiskFactors_HBV_Histochemistry.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('hbvHistoChemistry').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('hbvHistoChemistry').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('hbvHistoChemistry').setValue('NA');
						else
							$('hbvHistoChemistry').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HBV_Histochemistry');

					// ACHCV
					if (tissue.eavData.RiskFactors_HCV_AcHCV != null) {
						var mod = tissue.eavData.RiskFactors_HCV_AcHCV.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('acHCV').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('acHCV').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('acHCV').setValue('NA');
						else
							$('acHCV').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HCV_AcHCV');

					// PCR HCV NON TUMORAL LIVER
					if (tissue.eavData.RiskFactors_HCV_PCR_HCV_NTLiver != null) {
						var mod = tissue.eavData.RiskFactors_HCV_PCR_HCV_NTLiver.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('pcrHCVNTLiver').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('pcrHCVNTLiver').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('pcrHCVNTLiver').setValue('NA');
						else
							$('pcrHCVNTLiver').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HCV_PCR_HCV_NTLiver');

					// PCR HCV TUMORAL LIVER
					if (tissue.eavData.RiskFactors_HCV_PCR_HCV_TLiver != null) {
						var mod = tissue.eavData.RiskFactors_HCV_PCR_HCV_TLiver.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('pcrHCVTLiver').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('pcrHCVTLiver').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('pcrHCVTLiver').setValue('NA');
						else
							$('pcrHCVTLiver').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_HCV_PCR_HCV_TLiver');

					// ALCOHOL
					if (tissue.eavData.RiskFactors_Alcohol != null) {
						var mod = tissue.eavData.RiskFactors_Alcohol.modality;
						if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "NO"
								|| mod.toUpperCase() == "FALSE")
							$('alcohol').setValue('NO');
						else if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "YES"
								|| mod.toUpperCase() == "TRUE") {
							$('alcohol').setValue('YES');
							$('alcoholQuantity').enable();
						}
						else if (mod.toUpperCase() == "NA")
							$('alcohol').setValue('NA');
						else if (mod.toUpperCase().indexOf('OCCASION') != -1)
							$('alcohol').setValue('Occasional');
						else
							$('alcohol').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_Alcohol');

					// ALCOHOL QUANTITY
					if (tissue.eavData.RiskFactors_AlcoholQuantity != null) {
						var mod = tissue.eavData.RiskFactors_AlcoholQuantity.modality;
						if (mod.toUpperCase() == '<30-60 G/DAY (F) OR <40-60 G/DAY (M)') {
							$('alcoholQuantity').options[0].selected = true;
						}
						else if (mod.toUpperCase() == '30-60 G/DAY (F) OR 40-60 G/DAY (M)') {
							$('alcoholQuantity').options[1].selected = true;
						}
						else if (mod.toUpperCase() == '60-80 G/DAY') {
							$('alcoholQuantity').options[2].selected = true;
						}
						else if (mod.toUpperCase() == '>80 G/DAY') {
							$('alcoholQuantity').options[3].selected = true;
						}
						else if (mod.toUpperCase() == 'NA') {
							$('alcoholQuantity').setValue('NA');
						}
						else
							$('alcoholQuantity').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_AlcoholQuantity');

					// TOBACCO
					if (tissue.eavData.RiskFactors_Tobacco != null) {
						var mod = tissue.eavData.RiskFactors_Tobacco.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE') {
							$('tobacco').setValue('YES');
							$('tobaccoQuantity').enable();
						}
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('tobacco').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('tobacco').setValue('NA');
						else
							$('tobacco').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_Tobacco');

					// TOBACCO QUANTITY
					if (tissue.eavData.RiskFactors_TobaccoPacksPerYear != null) {
						var mod = tissue.eavData.RiskFactors_TobaccoPacksPerYear;
						$('tobaccoQuantity').setValue(mod);

					}
					variablesWithCustomInput.push('RiskFactors_TobaccoPacksPerYear');

					// HEMOCHROMATOSIS
					if (tissue.eavData.RiskFactors_Hemochromatosis != null) {
						if (tissue.eavData.RiskFactors_Hemochromatosis.modality.toUpperCase() == "OUI"
								|| tissue.eavData.RiskFactors_Hemochromatosis.modality
										.toUpperCase() == "TRUE"
								|| tissue.eavData.RiskFactors_Hemochromatosis.modality
										.toUpperCase() == "YES")
							$('hemochromatosis').setValue('YES');
						else if (tissue.eavData.RiskFactors_Hemochromatosis.modality.toUpperCase() == "NON"
								|| tissue.eavData.RiskFactors_Hemochromatosis.modality
										.toUpperCase() == "FALSE"
								|| tissue.eavData.RiskFactors_Hemochromatosis.modality
										.toUpperCase() == "NO")
							$('hemochromatosis').setValue('NO');
						else if (tissue.eavData.RiskFactors_Hemochromatosis.modality.toUpperCase() == "NA")
							$('hemochromatosis').setValue('NA');
						else
							$('hemochromatosis').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_Hemochromatosis');

					// GLYCOGENOSIS
					if (tissue.eavData.RiskFactors_Glycogenosis != null) {
						var mod = tissue.eavData.RiskFactors_Glycogenosis.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES")
							$('glycogenosis').setValue('YES');
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('glycogenosis').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('glycogenosis').setValue('NA');
						else
							$('glycogenosis').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_Glycogenosis');

					// NASH
					if (tissue.eavData.RiskFactors_NASH != null) {
						var mod = tissue.eavData.RiskFactors_NASH.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES")
							$('NASH').setValue('YES');
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('NASH').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('NASH').setValue('NA');
						else if (mod.toUpperCase().indexOf('SUSPI') != -1)
							$('NASH').setValue('Suspicion');
						else
							$('NASH').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_NASH');

					// DIABETES
					if (tissue.eavData.RiskFactors_Diabetes != null) {
						var mod = tissue.eavData.RiskFactors_Diabetes.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES") {
							$('diabetes').setValue('YES');
							$('diabetesYears').enable();
							$('diabetesType').enable();
						}
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('diabetes').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('diabetes').setValue('NA');
						else
							$('diabetes').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_Diabetes');

					// DIABETES YEARS
					if (tissue.eavData.RiskFactors_DiabetesYears != null) {
						var mod = tissue.eavData.RiskFactors_DiabetesYears.modality;
						$('diabetesYears').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_DiabetesYears');

					// DIABETES TYPE
					if (tissue.eavData.RiskFactors_DiabetesType != null) {
						var mod = tissue.eavData.RiskFactors_DiabetesType.modality;
						if (mod.toUpperCase() == "TYPE 1")
							$('diabetesType').setValue('Type 1');
						else if (mod.toUpperCase() == "TYPE 2")
							$('diabetesType').setValue('Type 2');
						else if (mod.toUpperCase().indexOf("MODY") != -1)
							$('diabetesType').setValue('MODY 3');
						else if (mod.toUpperCase() == 'NA')
							$('diabetesType').setValue('NA');
						else
							$('diabetesType').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_DiabetesType');

					// BMI
					if (tissue.eavData.RiskFactors_BMI != null) {
						var mod = tissue.eavData.RiskFactors_BMI.modality;
						$('bmi').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_BMI');

					// HEIGHT
					if (tissue.eavData.RiskFactors_Height != null) {
						var mod = tissue.eavData.RiskFactors_Height.modality;
						$('height').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_Height');

					// WEIGHT
					if (tissue.eavData.RiskFactors_Weight != null) {
						var mod = tissue.eavData.RiskFactors_Weight.modality;
						$('weight').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_Weight');

					// ORAL CONTRACEPTION
					if (tissue.eavData.RiskFactors_OralContraception != null) {
						var mod = tissue.eavData.RiskFactors_OralContraception.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES") {
							$('oralContraception').setValue('YES');
							$('contraceptionAgeFirstUse').enable();
							$('contraceptionYearsUsed').enable();
						}
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('oralContraception').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('oralContraception').setValue('NA');
						else
							$('oralContraception').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_OralContraception');

					// ORAL CONTRACEPTION AGE AT FIRST USE
					if (tissue.eavData.RiskFactors_OralContraception_AgeAtFirstUse != null) {
						var mod = tissue.eavData.RiskFactors_OralContraception_AgeAtFirstUse.modality;
						$('contraceptionAgeFirstUse').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_OralContraception_AgeAtFirstUse');

					// ORAL CONTRACEPTION YEARS OF USE
					if (tissue.eavData.RiskFactors_OralContraception_YearsOfUse != null) {
						var mod = tissue.eavData.RiskFactors_OralContraception_YearsOfUse.modality;
						$('contraceptionYearsUsed').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_OralContraception_YearsOfUse');

					// CONTRACEPTION TYPE
					if (tissue.eavData.RiskFactors_OralContraception_Type != null) {
						var mod = tissue.eavData.RiskFactors_OralContraception_Type.modality;
						$('contraceptionType').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_OralContraception_Type');

					// LONG TERM DRUGS
					if (tissue.eavData.RiskFactors_OnLongTermDrugs != null) {
						var mod = tissue.eavData.RiskFactors_OnLongTermDrugs.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES") {
							$('longTermDrugsYears').enable();
							$('longTermDrugsTypes').enable();
							$('longTermDrugs').setValue('YES');

						}
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('longTermDrugs').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('longTermDrugs').setValue('NA');
						else
							$('longTermDrugs').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs');

					// LONG TERM DRUGS - YEARS OF USE
					if (tissue.eavData.RiskFactors_OnLongTermDrugs_YearsUsed != null) {
						$('longTermDrugsYears').setValue(
								tissue.eavData.RiskFactors_OnLongTermDrugs_YearsUsed.modality);
					}
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs_YearsUsed');

					// LONG TERM DRUGS - TYPE
					var isND = true;
					if (tissue.eavData.RiskFactors_OnLongTermDrugs_Barbiturates != null) {
						var upMod = tissue.eavData.RiskFactors_OnLongTermDrugs_Barbiturates.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('longTermDrugsTypes').options[0].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RiskFactors_OnLongTermDrugs_Hormones != null) {
						var upMod = tissue.eavData.RiskFactors_OnLongTermDrugs_Hormones.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('longTermDrugsTypes').options[1].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RiskFactors_OnLongTermDrugs_SexualHormones != null) {
						var upMod = tissue.eavData.RiskFactors_OnLongTermDrugs_SexualHormones.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('longTermDrugsTypes').options[2].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RiskFactors_OnLongTermDrugs_Steroids != null) {
						var upMod = tissue.eavData.RiskFactors_OnLongTermDrugs_Steroids.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							$('longTermDrugsTypes').options[3].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RiskFactors_OnLongTermDrugs_Other != null) {
						var mod = tissue.eavData.RiskFactors_OnLongTermDrugs_Other.modality;
						var upMod = mod.toUpperCase();
						if (upMod != 'FALSE' && upMod != 'NULL' && upMod != 'NON' && upMod != 'NO') {
							$('longTermDrugsTypes').options[4].selected = true;
							isND = false;
							$('longTermDrugsMisc').enable();
							$('longTermDrugsMisc').update(mod);
						}
					}
					if (!isND) {
						$('longTermDrugsMisc').enable();
						$('longTermDrugsTypes').options[5].selected = false;
					}
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs_Barbiturates');
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs_Hormones');
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs_SexualHormones');
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs_Steroids');
					variablesWithCustomInput.push('RiskFactors_OnLongTermDrugs_Other');

					// AUTOIMMUNE DISEASE
					if (tissue.eavData.RiskFactors_AutoimmuneDisease != null) {
						var mod = tissue.eavData.RiskFactors_AutoimmuneDisease.modality;
						if (mod.toUpperCase().indexOf('HEPATITIS') != -1)
							$('autoimmuneDisease').options[0].selected = true;
						else if (mod.toUpperCase().indexOf('CIRRHOSIS') != -1)
							$('autoimmuneDisease').options[1].selected = true;
						else if (mod.toUpperCase() == 'CSP'
								|| mod.toUpperCase().indexOf('CHOLANGITIS') != -1)
							$('autoimmuneDisease').options[2].selected = true;
						else if (mod.toUpperCase().indexOf('SUSPECTED') != -1
								|| mod.toUpperCase().indexOf('UNKNOWN') != -1)
							$('autoimmuneDisease').options[3].selected = true;
						else if (mod.toUpperCase() == 'FALSE' || mod.toUpperCase() == 'NON'
								|| mod.toUpperCase() == 'NONE')
							$('autoimmuneDisease').setValue('NO');
						else
							$('autoimmuneDisease').setValue('-');

					}
					variablesWithCustomInput.push('RiskFactors_AutoimmuneDisease');

					// GEOGRAPHIC ORIGIN
					if (tissue.eavData.RiskFactors_GeographicOrigin != null) {
						var mod = tissue.eavData.RiskFactors_GeographicOrigin.modality;
						if (mod.toUpperCase() == 'FRANCE')
							$('geographicOrigin').setValue('France');
						else if (mod.toUpperCase().indexOf('MEDITERRA') != -1)
							$('geographicOrigin').setValue('Mediterranean Basin');
						else if (mod.toUpperCase().indexOf('AFRICA') != -1)
							$('geographicOrigin').setValue('Africa');
						else if (mod.toUpperCase().indexOf('ASIA') != -1)
							$('geographicOrigin').setValue('Asia');
						else if (mod.trim().length > 0) {
							$('otherGeographicOrigin').enable();
							$('otherGeographicOrigin').setValue(mod);
							$('geographicOrigin').setValue('Other');
						}
					}
					variablesWithCustomInput.push('RiskFactors_GeographicOrigin');

					// OTHER VIRUS
					if (tissue.eavData.RiskFactors_OtherVirus != null) {
						var mod = tissue.eavData.RiskFactors_OtherVirus.modality;
						$('otherVirus').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_OtherVirus');

					// STAY IN AFRICA > 6 MONTHS
					if (tissue.eavData.RiskFactors_StayedInAfricaMoreThan6Months != null) {
						var mod = tissue.eavData.RiskFactors_StayedInAfricaMoreThan6Months.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES")
							$('stayInAfrica').setValue('YES');
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('stayInAfrica').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('stayInAfrica').setValue('NA');
						else
							$('stayInAfrica').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_StayedInAfricaMoreThan6Months');

					// STAY IN ASIA > 6 MONTHS
					if (tissue.eavData.RiskFactors_StayedInAsiaMoreThan6Months != null) {
						var mod = tissue.eavData.RiskFactors_StayedInAsiaMoreThan6Months.modality;
						if (mod.toUpperCase() == "OUI" || mod.toUpperCase() == "TRUE"
								|| mod.toUpperCase() == "YES")
							$('stayInAsia').setValue('YES');
						else if (mod.toUpperCase() == "NON" || mod.toUpperCase() == "FALSE"
								|| mod.toUpperCase() == "NO")
							$('stayInAsia').setValue('NO');
						else if (mod.toUpperCase() == "NA")
							$('stayInAsia').setValue('NA');
						else
							$('stayInAsia').setValue('-');
					}
					variablesWithCustomInput.push('RiskFactors_StayedInAsiaMoreThan6Months');

					// OTHER RISK FACTORS
					if (tissue.eavData.RiskFactors_Misc != null) {
						var mod = tissue.eavData.RiskFactors_Misc.modality;
						$('riskFactorsMisc').setValue(mod);
					}
					variablesWithCustomInput.push('RiskFactors_Misc');

					// ---------- FAMILY DATA ---------- //
					if (tissue.eavData.FamilyData_Diabetes != null) {
						var upMod = tissue.eavData.FamilyData_Diabetes.modality.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'OUI' || upMod == 'YES') {
							$('familyDiabetes').setValue('YES');
							$('familyDiabetesType').enable();
						}
						else if (upMod == 'FALSE' || upMod == 'NON' || upMod == 'NO')
							$('familyDiabetes').setValue('NO');
						else if (upMod == 'NA')
							$('familyDiabetes').setValue('NA');
					}
					variablesWithCustomInput.push('FamilyData_Diabetes');

					isND = true;
					if (tissue.eavData.FamilyData_Diabetes_Type1 != null) {
						var upMod = tissue.eavData.FamilyData_Diabetes_Type1.modality.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyDiabetesType').options[0].selected == true;
							isND = false;
						}
					}
					if (tissue.eavData.FamilyData_Diabetes_Type2 != null) {
						var upMod = tissue.eavData.FamilyData_Diabetes_Type2.modality.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyDiabetesType').options[1].selected == true;
							isND = false;
						}
					}
					if (tissue.eavData.FamilyData_Diabetes_MODY3 != null) {
						var upMod = tissue.eavData.FamilyData_Diabetes_MODY3.modality.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyDiabetesType').options[2].selected == true;
							isND = false;
						}
					}
					if (!isND) {
						$('familyDiabetesType').enable();
						$('familyDiabetesType').options[3].selected == false;
					}
					variablesWithCustomInput.push('FamilyData_Diabetes_Type2');
					variablesWithCustomInput.push('FamilyData_Diabetes_Type1');
					variablesWithCustomInput.push('FamilyData_Diabetes_MODY3');

					isND = true;
					if (tissue.eavData.FamilyData_Treatment_Hypertension != null) {
						var upMod = tissue.eavData.FamilyData_Treatment_Hypertension.modality
								.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyTreatmentRegimen').options[0].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.FamilyData_Treatment_Hypercholesterolemia != null) {
						var upMod = tissue.eavData.FamilyData_Treatment_Hypercholesterolemia.modality
								.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyTreatmentRegimen').options[1].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.FamilyData_Treatment_Hypertriglyceridemia != null) {
						var upMod = tissue.eavData.FamilyData_Treatment_Hypertriglyceridemia.modality
								.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyTreatmentRegimen').options[2].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.FamilyData_Treatment_Diabetes != null) {
						var upMod = tissue.eavData.FamilyData_Treatment_Diabetes.modality
								.toUpperCase();
						if (upMod == 'YES' || upMod == 'TRUE' || upMod == 'OUI') {
							$('familyTreatmentRegimen').options[3].selected = true;
							isND = false;
						}
					}
					if (!isND) {
						$('familyTreatmentRegimen').enable();
						$('familyTreatmentRegimen').options[4].selected = false;
					}
					variablesWithCustomInput.push('FamilyData_Treatment_Diabetes');
					variablesWithCustomInput.push('FamilyData_Treatment_Hypercholesterolemia');
					variablesWithCustomInput.push('FamilyData_Treatment_Hypertension');
					variablesWithCustomInput.push('FamilyData_Treatment_Hypertriglyceridemia');

					if (tissue.eavData.FamilyData_Obesity != null) {
						var upMod = tissue.eavData.FamilyData_Obesity.modality.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'OUI' || upMod == 'YES')
							$('familyObesity').setValue('YES');
						else if (upMod == 'FALSE' || upMod == 'NON' || upMod == 'NO')
							$('familyObesity').setValue('NO');
						else if (upMod == 'NA')
							$('familyObesity').setValue('NA');
					}
					variablesWithCustomInput.push('FamilyData_Obesity');

					if (tissue.eavData.FamilyData_PolyposisColi != null) {
						var upMod = tissue.eavData.FamilyData_PolyposisColi.modality.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'OUI' || upMod == 'YES')
							$('familyPolyposisColi').setValue('YES');
						else if (upMod == 'FALSE' || upMod == 'NON' || upMod == 'NO')
							$('familyPolyposisColi').setValue('NO');
						else if (upMod == 'NA')
							$('familyPolyposisColi').setValue('NA');
					}
					variablesWithCustomInput.push('FamilyData_PolyposisColi');

					if (tissue.eavData.FamilyData_LiverAdenomasAdenomatosisMODY3 != null) {
						var upMod = tissue.eavData.FamilyData_LiverAdenomasAdenomatosisMODY3.modality
								.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'OUI' || upMod == 'YES')
							$('familyAdenomasAdenomatosisMODY3').setValue('YES');
						else if (upMod == 'FALSE' || upMod == 'NON' || upMod == 'NO')
							$('familyAdenomasAdenomatosisMODY3').setValue('NO');
						else if (upMod == 'NA')
							$('familyAdenomasAdenomatosisMODY3').setValue('NA');
					}
					variablesWithCustomInput.push('FamilyData_LiverAdenomasAdenomatosisMODY3');

					if (tissue.eavData.FamilyData_MalignantPrimaryLiverTumors != null) {
						var upMod = tissue.eavData.FamilyData_MalignantPrimaryLiverTumors.modality
								.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'OUI' || upMod == 'YES') {
							$('familyMalignantPrimaryLiverTumors').setValue('YES');
							$('familyMalignantPrimaryLiverTumorsDescription').enable();
						}
						else if (upMod == 'FALSE' || upMod == 'NON' || upMod == 'NO')
							$('familyMalignantPrimaryLiverTumors').setValue('NO');
						else if (upMod == 'NA')
							$('familyMalignantPrimaryLiverTumors').setValue('NA');
					}
					variablesWithCustomInput.push('FamilyData_MalignantPrimaryLiverTumors');

					if (tissue.eavData.FamilyData_MalignantPrimaryLiverTumors_Description != null) {
						var mod = tissue.eavData.FamilyData_MalignantPrimaryLiverTumors_Description.modality;
						$('familyMalignantPrimaryLiverTumorsDescription').setValue(mod);
					}
					variablesWithCustomInput
							.push('FamilyData_MalignantPrimaryLiverTumors_Description');

					if (tissue.eavData.FamilyData_HistoryMalignantTumors != null) {
						var upMod = tissue.eavData.FamilyData_HistoryMalignantTumors.modality
								.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'OUI' || upMod == 'YES') {
							$('familyHistoryMalignantTumors').setValue('YES');
							$('familyHistoryMalignantTumorsDescription').enable();
						}
						else if (upMod == 'FALSE' || upMod == 'NON' || upMod == 'NO')
							$('familyHistoryMalignantTumors').setValue('NO');
						else if (upMod == 'NA')
							$('familyHistoryMalignantTumors').setValue('NA');
					}
					variablesWithCustomInput.push('FamilyData_HistoryMalignantTumors');

					if (tissue.eavData.FamilyData_HistoryMalignantTumors_Description != null) {
						var mod = tissue.eavData.FamilyData_HistoryMalignantTumors_Description.modality;
						$('familyHistoryMalignantTumorsDescription').setValue(mod);
					}
					variablesWithCustomInput.push('FamilyData_HistoryMalignantTumors_Description');

					// ---------- SURVIVAL DATA ---------- //

					// LAST NEWS DATE
					if (tissue.eavData.SurvivalData_lastNewsDate != null) {
						var mod = tissue.eavData.SurvivalData_lastNewsDate.modality;
						$('lastNewsDate').setValue(mod);
					}
					variablesWithCustomInput.push('SurvivalData_lastNewsDate');

					// IS ALIVE
					if (tissue.eavData.SurvivalData_isAlive != null) {
						var upMod = tissue.eavData.SurvivalData_isAlive.modality.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI')
							$('isAlive').checked = true;
					}
					variablesWithCustomInput.push('SurvivalData_isAlive');

					// ALIVE W/WO RELAPSE
					if (tissue.eavData.SurvivalData_AliveWithOrWithoutRelapse != null) {
						var upMod = tissue.eavData.SurvivalData_AliveWithOrWithoutRelapse.modality
								.toUpperCase();
						if (upMod.indexOf('WITHOUT') != -1) {
							$('aliveWithOrWithoutRelapse').setValue('Without relapse');
						}
						else if (upMod.indexOf('WITH') != -1) {
							$('aliveWithOrWithoutRelapse').setValue('With relapse');
						}
						else if (upMod == 'NA')
							$('aliveWithOrWithoutRelapse').setValue('NA');
					}
					variablesWithCustomInput.push('SurvivalData_AliveWithOrWithoutRelapse');

					// RELAPSE DATE
					if (tissue.eavData.SurvivalData_RelapseDate != null) {
						var mod = tissue.eavData.SurvivalData_RelapseDate.modality;
						$('relapseDate').setValue(mod);
					}
					variablesWithCustomInput.push('SurvivalData_RelapseDate');

					// IS DECEASED
					if (tissue.eavData.SurvivalData_isDeceased != null) {
						var upMod = tissue.eavData.SurvivalData_isDeceased.modality.toUpperCase();
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI')
							$('isDeceased').checked = true;
					}
					variablesWithCustomInput.push('SurvivalData_isDeceased');

					// CAUSE OF DEATH
					if (tissue.eavData.SurvivalData_DeathFromDiseaseOrOtherEtiology != null) {
						var upMod = tissue.eavData.SurvivalData_DeathFromDiseaseOrOtherEtiology.modality
								.toUpperCase();
						if (upMod.indexOf('DISEASE') != -1) {
							$('deathFromDiseaseOtherEtiology').setValue('From disease');
						}
						else if (upMod.indexOf('OTHER') != -1) {
							$('deathFromDiseaseOtherEtiology').setValue('From other etiology');
						}
						else if (upMod == 'NA')
							$('deathFromDiseaseOtherEtiology').setValue('NA');
					}
					variablesWithCustomInput.push('SurvivalData_DeathFromDiseaseOrOtherEtiology');

					// DATE OF DEATH
					if (tissue.eavData.SurvivalData_DateOfDeath != null) {
						var mod = tissue.eavData.SurvivalData_DateOfDeath.modality;
						$('dateOfDeath').setValue(mod);
					}
					variablesWithCustomInput.push('SurvivalData_DateOfDeath');

					// SURVIVAL WO/ RELAPSE
					if (tissue.eavData.SurvivalData_SurvivalWithoutRelapse != null) {
						var mod = tissue.eavData.SurvivalData_SurvivalWithoutRelapse.modality;
						$('survivalWoRelapse').setValue(mod);
					}
					variablesWithCustomInput.push('SurvivalData_SurvivalWithoutRelapse');

					// TOTAL SURVIVAL
					if (tissue.eavData.SurvivalData_TotalSurvival != null) {
						var mod = tissue.eavData.SurvivalData_TotalSurvival.modality;
						$('totalSurvival').setValue(mod);
					}
					variablesWithCustomInput.push('SurvivalData_TotalSurvival');

					// ---------- RELAPSE DATA ---------- //

					// RELAPSE TREATMENT
					isND = true;
					var formElement = $('relapseTreatment');
					if (tissue.eavData.RelapseData_RelapseTreatment_HepaticTransplantation != null) {
						var upMod = tissue.eavData.RelapseData_RelapseTreatment_HepaticTransplantation.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							formElement.options[0].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RelapseData_RelapseTreatment_Hepatectomy != null) {
						var upMod = tissue.eavData.RelapseData_RelapseTreatment_Hepatectomy.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							formElement.options[1].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RelapseData_RelapseTreatment_Chemoembolization != null) {
						var upMod = tissue.eavData.RelapseData_RelapseTreatment_Chemoembolization.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							formElement.options[2].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RelapseData_RelapseTreatment_Alcoholization != null) {
						var upMod = tissue.eavData.RelapseData_RelapseTreatment_Alcoholization.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							formElement.options[3].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RelapseData_RelapseTreatment_Chemotherapy != null) {
						var upMod = tissue.eavData.RelapseData_RelapseTreatment_Chemotherapy.modality;
						if (upMod == 'TRUE' || upMod == 'YES' || upMod == 'OUI') {
							formElement.options[4].selected = true;
							isND = false;
						}
					}
					if (tissue.eavData.RelapseData_RelapseTreatment_Other != null) {
						var mod = tissue.eavData.RelapseData_RelapseTreatment_Other.modality;
						var upMod = mod.toUpperCase();
						if (upMod != 'FALSE' && upMod != 'NULL' && upMod != 'NON' && upMod != 'NO') {
							formElement.options[5].selected = true;
							isND = false;
							$('relapseTreatmentMisc').enable();
							$('relapseTreatmentMisc').update(mod);
						}
					}
					if (!isND) {
						$('relapseTreatmentMisc').enable();
						formElement.options[6].selected = false;
					}
					variablesWithCustomInput
							.push('RelapseData_RelapseTreatment_HepaticTransplantation');
					variablesWithCustomInput.push('RelapseData_RelapseTreatment_Hepatectomy');
					variablesWithCustomInput.push('RelapseData_RelapseTreatment_Chemoembolization');
					variablesWithCustomInput.push('RelapseData_RelapseTreatment_Alcoholization');
					variablesWithCustomInput.push('RelapseData_RelapseTreatment_Chemotherapy');
					variablesWithCustomInput.push('RelapseData_RelapseTreatment_Other');

					// ---------- PATHOLOGY ---------- //

					// LARGEST NODULE DIAMETER
					// if(tissue.eavData.PathologicalData_LargestNoduleDiameter
					// != null)
					// $('largestNoduleDiameter').setValue(tissue.eavData.PathologicalData_LargestNoduleDiameter.modality);
					// variablesWithCustomInput.push('PathologicalData_LargestNoduleDiameter');

					// NB DISTAL NODULES
					if (tissue.eavData.PathologicalData_nbDistalNodules != null)
						$('nbDistalNodules').setValue(
								tissue.eavData.PathologicalData_nbDistalNodules.modality);
					variablesWithCustomInput.push('PathologicalData_nbDistalNodules');

					// DISTAL SATELLITES NODULES
					if (tissue.eavData.PathologicalData_DistalSatelliteNodules != null) {
						var mod = tissue.eavData.PathologicalData_DistalSatelliteNodules.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('distalSatelliteNodules').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('distalSatelliteNodules').setValue('NO');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'A')
							$('distalSatelliteNodules').setValue('NA');
						else
							$('distalSatelliteNodules').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_DistalSatelliteNodules');

					// DIFFERENCIATION (WHO)
					if (tissue.eavData.PathologicalData_Differenciation_WHO != null) {
						var mod = tissue.eavData.PathologicalData_Differenciation_WHO.modality;
						if (mod.toUpperCase() == 'P' || mod.toUpperCase() == 'WEAK')
							$('differenciationWHO').setValue('Weak');
						else if (mod.toUpperCase() == 'B' || mod.toUpperCase() == 'GOOD')
							$('differenciationWHO').setValue('Good');
						else if (mod.toUpperCase() == 'M' || mod.toUpperCase() == 'MEDIUM')
							$('differenciationWHO').setValue('Medium');
						else
							$('differenciationWHO').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_Differenciation_WHO');

					// PORTAL INVASION
					if (tissue.eavData.PathologicalData_PortalVein_Invasion != null) {
						if (tissue.eavData.PathologicalData_PortalVein_Invasion.modality
								.toUpperCase() == "OUI"
								|| tissue.eavData.PathologicalData_PortalVein_Invasion.modality
										.toUpperCase() == "TRUE"
								|| tissue.eavData.PathologicalData_PortalVein_Invasion.modality
										.toUpperCase() == "YES")
							$('portalInvasion').setValue('YES');
						else if (tissue.eavData.PathologicalData_PortalVein_Invasion.modality
								.toUpperCase() == "NON"
								|| tissue.eavData.PathologicalData_PortalVein_Invasion.modality
										.toUpperCase() == "FALSE"
								|| tissue.eavData.PathologicalData_PortalVein_Invasion
										.toUpperCase() == "NO")
							$('portalInvasion').setValue('NO');
						else
							$('portalInvasion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_PortalVein_Invasion');

					// VASCULAR INVASION
					if (tissue.eavData.PathologicalData_VascularInvasion != null) {
						if (tissue.eavData.PathologicalData_VascularInvasion.modality.toUpperCase() == "OUI"
								|| tissue.eavData.PathologicalData_VascularInvasion.modality
										.toUpperCase() == "YES"
								|| tissue.eavData.PathologicalData_VascularInvasion.modality
										.toUpperCase() == "TRUE")
							$('vascularInvasion').setValue('YES');
						else if (tissue.eavData.PathologicalData_VascularInvasion.modality
								.toUpperCase() == "NON"
								|| tissue.eavData.PathologicalData_VascularInvasion.modality
										.toUpperCase() == "NO"
								|| tissue.eavData.PathologicalData_VascularInvasion.modality
										.toUpperCase() == "FALSE")
							$('vascularInvasion').setValue('NO');
						else
							$('vascularInvasion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_VascularInvasion');

					// NODULE SIZE (LARGEST AXIS)
					if (tissue.eavData.PathologicalData_NoduleSizeLargestAxis != null) {
						var mod = tissue.eavData.PathologicalData_NoduleSizeLargestAxis.modality;
						$('noduleSizeLargestAxis').setValue(mod);
					}
					variablesWithCustomInput.push('PathologicalData_NoduleSizeLargestAxis');

					// SURGICAL MARGIN
					if (tissue.eavData.PathologicalData_SurgicalMargin != null) {
						var mod = tissue.eavData.PathologicalData_SurgicalMargin.modality;
						$('surgicalMargin').setValue(mod);
					}
					variablesWithCustomInput.push('PathologicalData_SurgicalMargin');

					// MACROSCOPIC PORTAL INVASION
					if (tissue.eavData.PathologicalData_PortalVein_MacroscopicInvasion != null) {
						var mod = tissue.eavData.PathologicalData_PortalVein_MacroscopicInvasion.modality;
						if (mod.toUpperCase() == 'YES' || mod.toUpperCase() == 'OUI'
								|| mod.toUpperCase() == 'TRUE')
							$('macroscopicPortalInvasion').setValue('YES');
						else if (mod.toUpperCase() == 'NO' || mod.toUpperCase() == 'NON'
								|| mod.toUpperCase() == 'FALSE')
							$('macroscopicPortalInvasion').setValue('NO');
						else
							$('macroscopicPortalInvasion').setValue('-');
					}
					variablesWithCustomInput
							.push('PathologicalData_PortalVein_MacroscopicInvasion');

					// MICROSCOPIC PORTAL INVASION
					if (tissue.eavData.PathologicalData_PortalVein_MicroscopicInvasion != null) {
						var mod = tissue.eavData.PathologicalData_PortalVein_MicroscopicInvasion.modality;
						if (mod.toUpperCase() == 'YES' || mod.toUpperCase() == 'OUI'
								|| mod.toUpperCase() == 'TRUE')
							$('microscopicPortalInvasion').setValue('YES');
						else if (mod.toUpperCase() == 'NO' || mod.toUpperCase() == 'NON'
								|| mod.toUpperCase() == 'FALSE')
							$('microscopicPortalInvasion').setValue('NO');
						else
							$('microscopicPortalInvasion').setValue('-');
					}
					variablesWithCustomInput
							.push('PathologicalData_PortalVein_MicroscopicInvasion');

					// EDMONSON GRADE
					if (tissue.eavData.PathologicalData_EdmonsonGrade != null) {
						if (tissue.eavData.PathologicalData_EdmonsonGrade.modality.toUpperCase() == "IV"
								|| tissue.eavData.PathologicalData_EdmonsonGrade.modality == "4")
							$('edmonsonGrade').setValue('IV');
						else if (tissue.eavData.PathologicalData_EdmonsonGrade.modality
								.toUpperCase() == "III"
								|| tissue.eavData.PathologicalData_EdmonsonGrade.modality == "3")
							$('edmonsonGrade').setValue('III');
						else if (tissue.eavData.PathologicalData_EdmonsonGrade.modality
								.toUpperCase() == "II"
								|| tissue.eavData.PathologicalData_EdmonsonGrade.modality == "2")
							$('edmonsonGrade').setValue('II');
						else if (tissue.eavData.PathologicalData_EdmonsonGrade.modality
								.toUpperCase() == "I"
								|| tissue.eavData.PathologicalData_EdmonsonGrade.modality == "1")
							$('edmonsonGrade').setValue('I');
						else
							$('edmonsonGrade').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_EdmonsonGrade');

					// HISTOLOGICAL PATTERN
					var histologicalpatternsCount = 0;
					var histologicalPatternsArray = [];
					if (tissue.eavData.PathologicalData_HistologicalPattern_Compact != null) {
						var mod = tissue.eavData.PathologicalData_HistologicalPattern_Compact.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							histologicalpatternsCount++;
							histologicalPatternsArray.push('Compact');
						}
					}
					if (tissue.eavData.PathologicalData_HistologicalPattern_Diffused != null) {
						var mod = tissue.eavData.PathologicalData_HistologicalPattern_Diffused.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							histologicalpatternsCount++;
							histologicalPatternsArray.push('Diffused');
						}
					}
					if (tissue.eavData.PathologicalData_HistologicalPattern_Macrotrabecular != null) {
						var mod = tissue.eavData.PathologicalData_HistologicalPattern_Macrotrabecular.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							histologicalpatternsCount++;
							histologicalPatternsArray.push('Macrotrabecular');
						}
					}
					if (tissue.eavData.PathologicalData_HistologicalPattern_Microtrabecular != null) {
						var mod = tissue.eavData.PathologicalData_HistologicalPattern_Microtrabecular.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							histologicalpatternsCount++;
							histologicalPatternsArray.push('Microtrabecular');
						}
					}
					if (tissue.eavData.PathologicalData_HistologicalPattern_Pseudoglandular != null) {
						var mod = tissue.eavData.PathologicalData_HistologicalPattern_Pseudoglandular.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							histologicalpatternsCount++;
							histologicalPatternsArray.push('Pseudoglandular');
						}
					}
					if (tissue.eavData.PathologicalData_HistologicalPattern_Scirrhous != null) {
						var mod = tissue.eavData.PathologicalData_HistologicalPattern_Scirrhous.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							histologicalpatternsCount++;
							histologicalPatternsArray.push('Scirrhous');
						}
					}

					if (histologicalpatternsCount > 0)
						$('histologicalPattern').setValue(histologicalPatternsArray);

					variablesWithCustomInput.push('PathologicalData_HistologicalPattern_Compact');
					variablesWithCustomInput.push('PathologicalData_HistologicalPattern_Diffused');
					variablesWithCustomInput
							.push('PathologicalData_HistologicalPattern_Macrotrabecular');
					variablesWithCustomInput
							.push('PathologicalData_HistologicalPattern_Microtrabecular');
					variablesWithCustomInput
							.push('PathologicalData_HistologicalPattern_Pseudoglandular');
					variablesWithCustomInput.push('PathologicalData_HistologicalPattern_Scirrhous');

					// DEGREE OF NUCLEAR ATYPIA
					if (tissue.eavData.PathologicalData_NuclearAtypiaDegree != null) {
						var mod = tissue.eavData.PathologicalData_NuclearAtypiaDegree.modality;
						if (mod == 1 || mod == 2 || mod == 3 || mod == 4)
							$('nuclearAtypiaDegree').setValue(mod);
						else if (mod.toUpperCase() == 'I')
							$('nuclearAtypiaDegree').setValue(1);
						else if (mod.toUpperCase() == 'II')
							$('nuclearAtypiaDegree').setValue(2);
						else if (mod.toUpperCase() == 'III')
							$('nuclearAtypiaDegree').setValue(3);
						else if (mod.toUpperCase() == 'IV')
							$('nuclearAtypiaDegree').setValue(4);
					}
					variablesWithCustomInput.push('PathologicalData_NuclearAtypiaDegree');

					// INTRANUCLEAR INCLUSIONS
					if (tissue.eavData.PathologicalData_IntranuclearInclusions != null) {
						var mod = tissue.eavData.PathologicalData_IntranuclearInclusions.modality;
						if (mod.toUpperCase() == 'YES' || mod.toUpperCase() == 'OUI'
								|| mod.toUpperCase() == 'TRUE')
							$('intranuclearInclusion').setValue('YES');
						else if (mod.toUpperCase() == 'NO' || mod.toUpperCase() == 'NON'
								|| mod.toUpperCase() == 'FALSE')
							$('intranuclearInclusion').setValue('NO');
						else
							$('intranuclearInclusion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_IntranuclearInclusions');

					// CLEAR CELLS
					if (tissue.eavData.PathologicalData_ClearCells != null) {
						var mod = tissue.eavData.PathologicalData_ClearCells.modality;
						if (mod.toUpperCase().indexOf('OUI') != -1
								|| mod.toUpperCase().indexOf('YES') != -1) {
							if (mod.toUpperCase().indexOf('TRES RARE') != -1
									|| mod.toUpperCase().indexOf('VERY SPARSE') != -1)
								$('clearCells').options[2].selected = true;
							else if (mod.toUpperCase().indexOf('RARE') != -1
									|| mod.toUpperCase().indexOf('SPARSE') != -1)
								$('clearCells').options[1].selected = true;
							else
								$('clearCells').options[0].selected = true;
						}
						else if (mod.toUpperCase().indexOf('NON') != -1
								|| mod.toUpperCase().indexOf('NO') != -1)
							$('clearCells').setValue('NO');
						else
							$('clearCells').setValue('-');
					}
					variablesWithCustomInput.push("PathologicalData_ClearCells");

					// EOSINOPHILIC INCLUSIONS
					if (tissue.eavData.PathologicalData_EosinophilicInclusions != null) {
						var mod = tissue.eavData.PathologicalData_EosinophilicInclusions.modality;

						if (mod.toUpperCase().indexOf('OUI') != -1
								|| mod.toUpperCase().indexOf('YES') != -1) {

							if (mod.toUpperCase().indexOf('TRES RARE') != -1
									|| mod.toUpperCase().indexOf('VERY SPARSE') != -1)
								$('eosinophilicInclusions').options[2].selected = true; // YES
							// very
							// sparse
							else if (mod.toUpperCase().indexOf('RARE') != -1
									|| mod.toUpperCase().indexOf('SPARSE') != -1) {
								if (mod.toUpperCase().indexOf('MALLORY') != -1)
									$('eosinophilicInclusions').options[4].selected = true; // YES
								// sparse
								// /
								// Mallory
								// body
								else
									$('eosinophilicInclusions').options[1].selected = true; // YES
								// sparse
							}
							else if (mod.toUpperCase().indexOf('MALLORY') != -1)
								$('eosinophilicInclusions').options[3].selected = true; // YES
							// Mallory
							// body
							else
								$('eosinophilicInclusions').options[0].selected = true; // Yes
						}
						else if (mod.toUpperCase().indexOf('NON') != -1
								|| mod.toUpperCase().indexOf('NO') != -1)
							$('eosinophilicInclusions').setValue('NO');
						else
							$('eosinophilicInclusions').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_EosinophilicInclusions');

					// SARCOMATOID APPEARANCE
					if (tissue.eavData.PathologicalData_SarcomatoidAppearance != null) {
						var mod = tissue.eavData.PathologicalData_SarcomatoidAppearance.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('sarcomatoidAppearance').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('sarcomatoidAppearance').setValue('NO');
						else
							$('sarcomatoidAppearance').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_SarcomatoidAppearance');

					// OSTEOCLAST-LIKE CELLS
					if (tissue.eavData.PathologicalData_OsteoclastLikeCells != null) {
						var mod = tissue.eavData.PathologicalData_OsteoclastLikeCells.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('osteoclastLikeCells').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('osteoclastLikeCells').setValue('NO');
						else
							$('osteoclastLikeCells').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_OsteoclastLikeCells');

					// ONCOCYTIC CELLS
					if (tissue.eavData.PathologicalData_OncocyticCells != null) {
						var mod = tissue.eavData.PathologicalData_OncocyticCells.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('oncocyticCells').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('oncocyticCells').setValue('NO');
						else
							$('oncocyticCells').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_OncocyticCells');

					// TUMORAL CHOLESTASIS
					if (tissue.eavData.PathologicalData_TumoralCholestasis != null) {
						var mod = tissue.eavData.PathologicalData_TumoralCholestasis.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('tumoralCholestasis').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('tumoralCholestasis').setValue('NO');
						else
							$('tumoralCholestasis').setValue('-');

					}
					variablesWithCustomInput.push('PathologicalData_TumoralCholestasis');

					// FIBROTIC STROMA
					if (tissue.eavData.PathologicalData_FibroticStroma != null) {
						var mod = tissue.eavData.PathologicalData_FibroticStroma.modality;
						if (mod.toUpperCase().indexOf('OUI') != -1
								|| mod.toUpperCase().indexOf('YES') != -1
								|| mod.toUpperCase().indexOf('TRUE') != -1) {
							if (mod.toUpperCase().indexOf('MINIMA') != -1)
								$('fibroticStroma').options[1].selected = true;
							else
								$('fibroticStroma').setValue('YES');
						}
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('fibroticStroma').setValue('NO');
						else
							$('fibroticStroma').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_FibroticStroma');

					// INFLAMMATION
					if (tissue.eavData.PathologicalData_Inflammation != null) {
						var mod = tissue.eavData.PathologicalData_Inflammation.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE') {
							$('inflammation').setValue('YES');
							checkInflammation();

							if (tissue.eavData.PathologicalData_InflammationType != null) {
								var mod2 = tissue.eavData.PathologicalData_InflammationType.modality;
								if (mod2.toUpperCase() == 'LY'
										|| mod2.toUpperCase() == 'LYMPHOCYTIC')
									$('inflammationType').setValue('Lymphocytic');
								else if (mod2.toUpperCase() == 'PN'
										|| mod2.toUpperCase() == 'NEUTROPHILS')
									$('inflammationType').setValue('Neutrophils');
								else if (mod2.toUpperCase() == 'MIXTE'
										|| mod2.toUpperCase() == 'MIXED')
									$('inflammationType').setValue('Mixed');
								else
									$('inflammationType').setValue('-');

							}
						}
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('inflammation').setValue('NO');
						else
							$('inflammation').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_Inflammation');
					variablesWithCustomInput.push('PathologicalData_InflammationType');

					// PELIOSIS / HEMORRHAGE
					if (tissue.eavData.PathologicalData_PeliosisHemorrhage != null) {
						var mod = tissue.eavData.PathologicalData_PeliosisHemorrhage.modality;
						if (mod.toUpperCase().indexOf('OUI') != -1
								|| mod.toUpperCase().indexOf('YES') != -1
								|| mod.toUpperCase().indexOf('TRUE') != -1) {
							if (mod.toUpperCase().indexOf('MINIMA') != -1)
								$('peliosisHemorrhage').options[1].selected = true;
							else
								$('peliosisHemorrhage').setValue('YES');
						}
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('peliosisHemorrhage').setValue('NO');
						else if (mod.toUpperCase() == 'NA')
							$('peliosisHemorrhage').setValue('NA');
						else
							$('peliosisHemorrhage').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_PeliosisHemorrhage');

					// PERINEURAL INVASION
					if (tissue.eavData.PathologicalData_PerineuralInvasion != null) {
						var mod = tissue.eavData.PathologicalData_PerineuralInvasion.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('perineuralInvasion').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('perineuralInvasion').setValue('NO');
						else
							$('perineuralInvasion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_PerineuralInvasion');

					// BILIARY INVASION
					if (tissue.eavData.PathologicalData_BiliaryTractInvasion != null) {
						var mod = tissue.eavData.PathologicalData_BiliaryTractInvasion.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('biliaryInvasion').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('biliaryInvasion').setValue('NO');
						else
							$('biliaryInvasion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_BiliaryTractInvasion');

					// TUMORAL CAPSULE
					if (tissue.eavData.PathologicalData_TumoralCapsule != null) {
						var mod = tissue.eavData.PathologicalData_TumoralCapsule.modality;
						if (mod.toUpperCase().indexOf('INTACT') != -1)
							$('tumoralCapsule').setValue('Intact');
						else if (mod.toUpperCase().indexOf('ABSENT') != -1)
							$('tumoralCapsule').setValue('Absent');
						else if (mod.toUpperCase() == 'INVADED' || mod.toUpperCase() == 'ENVAHIE')
							$('tumoralCapsule').setValue('Invaded');
						else if (mod.toUpperCase() == 'NA')
							$('tumoralCapsule').setValue('NA');
						else
							$('tumoralCapsule').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_TumoralCapsule');

					// GLISSON CAPSULE INVASION
					if (tissue.eavData.PathologicalData_GlissonCapsuleInvasion != null) {
						var mod = tissue.eavData.PathologicalData_GlissonCapsuleInvasion.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('glissonCapsuleInvasion').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('glissonCapsuleInvasion').setValue('NO');
						else
							$('glissonCapsuleInvasion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_GlissonCapsuleInvasion');

					// EXTRAHEPATIC INVASION
					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion.modality;
						if (mod.toUpperCase() == 'YES' || mod.toUpperCase() == 'OUI'
								|| mod.toUpperCase() == 'TRUE') {
							if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
									|| mod.toUpperCase() == 'TRUE') {
								$('extraHepaticInvasion').setValue('YES');
								checkExtraHepaticInvasion();
							}
							else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
									|| mod.toUpperCase() == 'FALSE')
								$('extraHepaticInvasion').setValue('NO');
							else
								$('extraHepaticInvasion').setValue('-');
						}
					}
					variablesWithCustomInput.push('PathologicalData_ExtraHepaticInvasion');

					// EXTRAHEPATIC INVASION TISSUE
					var extraHepaticInvasionTissueCount = 0;
					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion_AbdominalCavity != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion_AbdominalCavity.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							extraHepaticInvasionTissueCount++;
							$('extraHepaticInvasionTissue').options[0].selected = true;
						}
					}
					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion_AdiposeTissue != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion_AdiposeTissue.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							extraHepaticInvasionTissueCount++;
							$('extraHepaticInvasionTissue').options[1].selected = true;
						}
					}

					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion_AdrenalGland != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion_AdrenalGland.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							extraHepaticInvasionTissueCount++;
							$('extraHepaticInvasionTissue').options[2].selected = true;
						}
					}
					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion_GallBladder != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion_GallBladder.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							extraHepaticInvasionTissueCount++;
							$('extraHepaticInvasionTissue').options[3].selected = true;
						}
					}
					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion_GallBladderAdventitia != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion_GallBladderAdventitia.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							extraHepaticInvasionTissueCount++;
							$('extraHepaticInvasionTissue').options[4].selected = true;
						}
					}
					if (tissue.eavData.PathologicalData_ExtraHepaticInvasion_Peritoneum != null) {
						var mod = tissue.eavData.PathologicalData_ExtraHepaticInvasion_Peritoneum.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'TRUE'
								|| mod.toUpperCase() == 'YES') {
							extraHepaticInvasionTissueCount++;
							$('extraHepaticInvasionTissue').options[5].selected = true;
						}
					}
					if (extraHepaticInvasionTissueCount != 0) {
						$('extraHepaticInvasionTissue').options[6].selected = false;
						$('extraHepaticInvasionTissue').enable();
						// enables the select list, even if the
						// PathologicalData_ExtraHepaticInvasion
						// variable is set to false, in order to allow the user
						// to unset this select list
						// (in case of an error)
					}

					variablesWithCustomInput
							.push('PathologicalData_ExtraHepaticInvasion_AbdominalCavity');
					variablesWithCustomInput
							.push('PathologicalData_ExtraHepaticInvasion_AdiposeTissue');
					variablesWithCustomInput
							.push('PathologicalData_ExtraHepaticInvasion_AdrenalGland');
					variablesWithCustomInput
							.push('PathologicalData_ExtraHepaticInvasion_GallBladder');
					variablesWithCustomInput
							.push('PathologicalData_ExtraHepaticInvasion_GallBladderAdventitia');
					variablesWithCustomInput
							.push('PathologicalData_ExtraHepaticInvasion_Peritoneum');

					// NECROSIS
					if (tissue.eavData.PathologicalData_Necrosis != null) {
						var mod = tissue.eavData.PathologicalData_Necrosis.modality;
						$('necrosis').setValue(mod);
					}
					variablesWithCustomInput.push('PathologicalData_Necrosis');

					// TUMORAL STEATOSIS
					if (tissue.eavData.PathologicalData_TumoralSteatosis != null) {
						var mod = tissue.eavData.PathologicalData_TumoralSteatosis.modality;
						if (mod == 0 || mod == 1 || mod == 2 || mod == 3 || mod == 4)
							$('tumoralSteatosis').setValue(mod);
						else
							$('tumoralSteatosis').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_TumoralSteatosis');

					// HEPATIC VEIN INVASION
					if (tissue.eavData.PathologicalData_HepaticVeinInvasion != null) {
						var mod = tissue.eavData.PathologicalData_HepaticVeinInvasion.modality;
						if (mod.toUpperCase() == 'OUI' || mod.toUpperCase() == 'YES'
								|| mod.toUpperCase() == 'TRUE')
							$('hepaticVeinInvasion').setValue('YES');
						else if (mod.toUpperCase() == 'NON' || mod.toUpperCase() == 'NO'
								|| mod.toUpperCase() == 'FALSE')
							$('hepaticVeinInvasion').setValue('NO');
						else
							$('hepaticVeinInvasion').setValue('-');
					}
					variablesWithCustomInput.push('PathologicalData_HepaticVeinInvasion');

					// MISCELLANEOUS PATHOLOGICAL DATA
					if (tissue.eavData.PathologicalData_MiscallenousInfo != null) {
						var mod = tissue.eavData.PathologicalData_MiscallenousInfo.modality;
						$('miscellaneousPathologicalData').setValue(mod);
					}
					variablesWithCustomInput.push('PathologicalData_MiscallenousInfo');

					// ---------- IMMUNO HISTO CHEMISTRY ---------- //

					// IHC BCAT MEMBRANE
					if (tissue.eavData.IHCData_Tumor_BCATMembrane != null) {
						var mod = tissue.eavData.IHCData_Tumor_BCATMembrane.modality;
						if (mod == 0 || mod == 1 || mod == 2)
							$('ihcBCATmembrane').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcBCATmembrane').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_BCATMembrane');

					// IHC BCAT CYTOPLASM
					if (tissue.eavData.IHCData_Tumor_BCATCytoplasm != null) {
						var mod = tissue.eavData.IHCData_Tumor_BCATCytoplasm.modality;
						if (mod == 0 || mod == 1 || mod == 2)
							$('ihcBCATcytoplasm').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcBCATcytoplasm').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_BCATCytoplasm');

					// IHC BCAT NUCLEUS
					if (tissue.eavData.IHCData_Tumor_BCATNucleus != null) {
						var mod = tissue.eavData.IHCData_Tumor_BCATNucleus.modality;
						if (mod == 0 || mod == 1 || mod == 2)
							$('ihcBCATnucleus').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcBCATnucleus').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_BCATNucleus');

					// IHC CK19 TUMOR
					if (tissue.eavData.IHCData_Tumor_CK19) {
						var mod = tissue.eavData.IHCData_Tumor_CK19.modality;
						if (mod == '0-1')
							$('ihcCK19Tumor').options[0].selected = true;
						else if (mod == '2')
							$('ihcCK19Tumor').options[1].selected = true;
						else if (mod == '2')
							$('ihcCK19Tumor').options[2].selected = true;
						else if (mod.toUpperCase() == 'NA')
							$('ihcCK19Tumor').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_CK19');

					// IHC EPCAM TUMOR
					if (tissue.eavData.IHCData_Tumor_EPCAM != null) {
						var mod = tissue.eavData.IHCData_Tumor_EPCAM.modality;
						if (mod == '0-1')
							$('ihcEPCAMTumor').options[0].selected = true;
						else if (mod == '2')
							$('ihcEPCAMTumor').options[1].selected = true;
						else if (mod == '3')
							$('ihcEPCAMTumor').options[2].selected = true;
						else if (mod.toUpperCase() == 'NA')
							$('ihcEPCAMTumor').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_EPCAM');

					// IHC GS LOCALIZATION
					if (tissue.eavData.IHCData_Tumor_GSLocalization != null) {
						var mod = tissue.eavData.IHCData_Tumor_GSLocalization.modality;
						if (mod.toUpperCase().indexOf('NEG') != -1 || mod.toUpperCase() == 'N')
							$('ihcGSlocalization').setValue('Negative');
						else if (mod.toUpperCase().indexOf('FOC') != -1 || mod.toUpperCase() == 'F')
							$('ihcGSlocalization').setValue('Focal');
						else if (mod.toUpperCase().indexOf('DIF') != -1 || mod.toUpperCase() == 'D')
							$('ihcGSlocalization').setValue('Diffused');
						else if (mod.toUpperCase() == 'NA')
							$('ihcGSlocalization').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_GSLocalization');

					// IHC GS INTENSITY
					if (tissue.eavData.IHCData_Tumor_GSIntensity != null) {
						var mod = tissue.eavData.IHCData_Tumor_GSIntensity.modality;
						if (mod.toUpperCase().indexOf('STRONG') != -1 || mod.toUpperCase() == 'S')
							$('ihcGSintensity').setValue('Strong');
						else if (mod.toUpperCase().indexOf('HETERO') != -1
								|| mod.toUpperCase() == 'H')
							$('ihcGSintensity').setValue('Heterogeneous');
						else if (mod.toUpperCase() == 'NA')
							$('ihcGSintensity').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_GSIntensity');

					// IHC ADRENOMEDULIN TUMOR
					if (tissue.eavData.IHCData_Tumor_Adrenomedulin != null) {
						var mod = tissue.eavData.IHCData_Tumor_Adrenomedulin.modality;
						if (mod == 0 || mod == 1 || mod == 2 || mod == 3 || mod == 4)
							$('ihcAdrenomedulinTumor').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcAdrenomedulinTumor').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_Adrenomedulin');

					// IHC ADRENOMEDULIN NT LIVER
					if (tissue.eavData.IHCData_NTLiver_Adrenomedulin != null) {
						var mod = tissue.eavData.IHCData_NTLiver_Adrenomedulin.modality;
						if (mod == 0 || mod == 1 || mod == 2 || mod == 3 || mod == 4)
							$('ihcAdrenomedulinNTLiver').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcAdrenomedulinNTLiver').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_NTLiver_Adrenomedulin');

					// IHC RAMP3 TUMOR
					if (tissue.eavData.IHCData_Tumor_RAMP3 != null) {
						var mod = tissue.eavData.IHCData_Tumor_RAMP3.modality;
						if (mod == 0 || mod == 1 || mod == 2 || mod == 3 || mod == 4)
							$('ihcRAMP3Tumor').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcRAMP3Tumor').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_Tumor_RAMP3');

					// IHC RAMP3 NT LIVER
					if (tissue.eavData.IHCData_NTLiver_RAMP3 != null) {
						var mod = tissue.eavData.IHCData_NTLiver_RAMP3.modality;
						if (mod == 0 || mod == 1 || mod == 2 || mod == 3 || mod == 4)
							$('ihcRAMP3NTLiver').setValue(mod);
						else if (mod.toUpperCase() == 'NA')
							$('ihcRAMP3NTLiver').setValue('NA');
					}
					variablesWithCustomInput.push('IHCData_NTLiver_RAMP3');
					
					
					//DISPLAYING CORRECT INFORMATION IN THE FORM FIELDS
					
					if($('chcID').getValue().trim() != tissue.chcID)
						$('chcID').setValue(tissue.chcID);
					if($('tissueTypeID').getValue().trim() != tissue.tissueTypeID)
						$('tissueTypeID').setValue(tissue.tissueTypeID);
					

					// LOAD REMAINING VARIABLE IN GENERIC INTERFACE

					loadCurrentTissueUnsetGenericVariables();
					displayGenericVariables2(tissue, false);
				},
				onFailure : function(transport) {
					handleErrorResponseWindow(transport.responseText); // cf.
					// common.js
				}
			});
}

function createTissue(chcID, tissueTypeID) {

}

function displayGenericVariables(tissue) {
	var genericVariableTableString = "";
	var eavData = $H(tissue.eavData);
	for ( var i = 0; i < eavData.keys().size(); i++) {
		var varName = eavData.keys()[i];
		if (variablesWithCustomInput.indexOf(varName) == -1 && !eavData.get(varName).deprecated) {
			var modality = eavData.get(varName).modality;
			genericVariableTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
					+ varName + " :</td>";

			genericVariableTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
					+ varName + "\" type=\"text\" value=\"" + modality + "\"/></td><td></td></tr>";
		}
	}

	$('genericVariablesContainer').update(genericVariableTableString);
}

function toggleDisplayingUnsetVariables() {
	if (displayingUnsetVariables == false) {
		displayGenericVariables2(currentTissue, true);
		displayingUnsetVariables = true;
	}
	else {
		displayGenericVariables2(currentTissue, false);
		displayingUnsetVariables = false;
	}
}

function displayGenericVariables2(tissue, displayUnsetVariables) {
	var genericVariableTableString = "";

	var genericClinicalVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">CLINICAL DATA :</td></tr>";
	var genericBiologicalVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">BIOLOGICAL DATA :</td></tr>";
	var genericNTLiverVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">NON TUMORAL LIVER DATA :</td></tr>";
	var genericPathologicalVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">PATHOLOGICAL DATA :</td></tr>";
	var genericMiscVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">MISC DATA :</td></tr>";
	var genericMutationVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">MUTATION DATA :</td></tr>";
	var genericRiskFactorsVariablesTableString = "<tr><td colspan='2' style=\"font-family: courier;font-size: 12pt;\">RISK FACTORS :</td></tr>";
	var eavData = $H(tissue.eavData);
	for ( var i = 0; i < eavData.keys().size(); i++) {
		var varName = eavData.keys()[i];
		if (variablesWithCustomInput.indexOf(varName) == -1 && !eavData.get(varName).deprecated) {
			var modality = eavData.get(varName).modality;

			if (varName.indexOf('ClinicalData_') == 0) {
				genericClinicalVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericClinicalVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
			else if (varName.indexOf('BiologicalData_') == 0) {
				genericBiologicalVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericBiologicalVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
			else if (varName.indexOf('NTLiver_') == 0) {
				genericNTLiverVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericNTLiverVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
			else if (varName.indexOf('Mutation_') == 0) {
				genericMutationVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericMutationVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
			else if (varName.indexOf('PathologicalData_') == 0) {
				genericPathologicalVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericPathologicalVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
			else if (varName.indexOf('RiskFactors_') == 0) {
				genericRiskFactorsVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericRiskFactorsVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
			else {
				genericMiscVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
						+ varName + " :</td>";
				genericMiscVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
						+ varName
						+ "\" type=\"text\" size=\"80\" maxlength=\"254\" value=\""
						+ modality
						+ "\"/></td><td></td></tr>";
			}
		}
	}

	if (displayUnsetVariables) {
		for ( var i = 0; i < currentTissueUnsetGenericVariables.size(); i++) {
			var variable = currentTissueUnsetGenericVariables[i];
			var varName = variable.variableName;
			if (variablesWithCustomInput.indexOf(varName) == -1 && !variable.deprecated) {

				if (varName.indexOf('ClinicalData_') == 0) {
					genericClinicalVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericClinicalVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
				else if (varName.indexOf('BiologicalData_') == 0) {
					genericBiologicalVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericBiologicalVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
				else if (varName.indexOf('NTLiver_') == 0) {
					genericNTLiverVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericNTLiverVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
				else if (varName.indexOf('Mutation_') == 0) {
					genericMutationVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericMutationVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
				else if (varName.indexOf('PathologicalData_') == 0) {
					genericPathologicalVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericPathologicalVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
				else if (varName.indexOf('RiskFactors_') == 0) {
					genericRiskFactorsVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericRiskFactorsVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
				else {
					genericMiscVariablesTableString += "<tr><td style=\"font-family: courier;font-size: 10pt;\">"
							+ varName + " :</td>";
					genericMiscVariablesTableString += "<td><input onchange=\"addChangedModality(this.id);\" id=\""
							+ varName + "\" type=\"text\" size=\"80\" maxlength=\"254\" /></td><td></td></tr>";
				}
			}
		}
	}

	
	genericVariableTableString = genericClinicalVariablesTableString + "<tr><td>&nbsp;</td></tr>"
			+ genericBiologicalVariablesTableString + "<tr><td>&nbsp;</td></tr>"
			+ genericPathologicalVariablesTableString + "<tr><td>&nbsp;</td></tr>"
			+ genericNTLiverVariablesTableString + "<tr><td>&nbsp;</td></tr>"
			+ genericRiskFactorsVariablesTableString + "<tr><td>&nbsp;</td></tr>"
			+ genericMutationVariablesTableString + "<tr><td>&nbsp;</td></tr>"
			+ genericMiscVariablesTableString;

	$('genericVariablesContainer').update(genericVariableTableString);
}

function addModalityInput() {
	$('addModalityButton').disable();
	var newModalityInputString = '<tr><td><select id=\"newModalityVariable\">';
	for ( var i = 0; i < currentTissueUnsetGenericVariables.size(); i++) {
		var unsetVariable = currentTissueUnsetGenericVariables[i];
		if (variablesWithCustomInput.indexOf(unsetVariable.variableName) == -1) {
			newModalityInputString += '<option >' + unsetVariable.variableName + ' ('
					+ unsetVariable.dataType + ') </option>';
		}
	}
	newModalityInputString += '</select> :</td><td><input id=\"newModalityValue\" type=\"text\"></td>'
			+ '<td><input type="button" value="Save" onClick="saveNewModality();"/>'
			+ '<input type="button" value="Cancel" onClick="cancelNewModality();"/></td></tr>';

	$('genericVariablesContainer').insert({
		bottom : newModalityInputString
	});
}

function cancelNewModality() {

	$('addModalityButton').enable();
}

function saveNewModality() {
	alert($('newModalityVariable').getValue().split(" ")[0] + ' : '
			+ $('newModalityValue').getValue());
	$('addModalityButton').enable();
}

function loadCurrentTissueUnsetGenericVariables() {
	new Ajax.Request('mainServlet', {
		method : 'POST',
		parameters : {
			appAction : 'ajaxLoadUnsetGenericVariables',
			tissue_chcID : currentTissue.chcID,
			tissue_tissueTypeID : currentTissue.tissueTypeID
		},
		onFailure : function(transport) {
			handleErrorResponseWindow(transport.responseText);
		},
		onSuccess : function(transport) {
			var unsetGenericVariables = transport.responseText.evalJSON(true);
			currentTissueUnsetGenericVariables = unsetGenericVariables;
		}
	});
}

function checkCirrhosis() {
	if ($('normalLiverHistology').options[1].selected == true) {
		$('micronodularCirrhosis').enable();
		$('macronodularCirrhosis').enable();
	}
	else {
		$('micronodularCirrhosis').checked = false;
		$('macronodularCirrhosis').checked = false;
		$('micronodularCirrhosis').disable();
		$('macronodularCirrhosis').disable();
	}
}

function displayTissue() {
	if ($('chcID').getValue() != null && $('chcID').getValue() != ''
			&& $('tissueTypeID').getValue() != null && $('tissueTypeID').getValue() != '')
		loadTissue($('chcID').getValue(), $('tissueTypeID').getValue().toUpperCase());
	else
		alert('You must choose a CHC ID and a Tissue Type ID');
}

function loadInitialTissue() {
	if ($('chcID').getValue() != null && $('chcID').getValue() != ''
			&& $('tissueTypeID').getValue() != null && $('tissueTypeID').getValue() != '') {
		displayTissue();
	}
}

function checkInflammation() {
	if ($('inflammation').getValue() == 'YES') {
		$('inflammationType').enable();
	}
	else {
		$('inflammationType').setValue('-');
		changedModalities.push('inflammationType');
		$('inflammationType').disable();

	}
}

function checkExtraHepaticInvasion() {
	if ($('extraHepaticInvasion').getValue() == 'YES') {
		$('extraHepaticInvasionTissue').enable();
	}
	else {
		$('extraHepaticInvasionTissue').setValue([ '-' ]);
		changedModalities.push('extraHepaticInvasionTissue');
		$('extraHepaticInvasionTissue').disable();

	}
}

function checkSex() {
	if ($('sex').getValue() == 'F') {
		$('nChildren').enable();
		$('ageMenopause').enable();
		$('oralContraception').enable();
	}
	else {
		$('nChildren').clear();
		$('ageMenopause').clear();
		$('nChildren').disable();
		$('ageMenopause').disable();
		if ($('sex').getValue() == 'M') {
			$('oralContraception').setValue('NO');
			changedModalities.push('oralContraception');
			changedModalities.push('ageMenopause');
			changedModalities.push('nChildren');
		}
		else if ($('sex').getValue() == '-') {
			$('oralContraception').setValue('-');
			changedModalities.push('oralContraception');
			changedModalities.push('ageMenopause');
			changedModalities.push('nChildren');
		}
		$('oralContraception').disable();
	}
	checkContraception();
}
function checkContraception() {
	if ($('oralContraception').getValue() == 'YES') {
		$('contraceptionAgeFirstUse').enable();
		$('contraceptionYearsUsed').enable();
		$('contraceptionType').enable();
	}
	else {
		$('contraceptionAgeFirstUse').clear();
		$('contraceptionYearsUsed').clear();
		$('contraceptionType').clear();
		$('contraceptionAgeFirstUse').disable();
		$('contraceptionYearsUsed').disable();
		$('contraceptionType').disable();
	}
}

function checkDiabetes() {
	if ($('diabetes').getValue() == 'YES') {
		$('diabetesYears').enable();
		$('diabetesType').enable();
	}
	else {
		$('diabetesYears').clear();
		$('diabetesType').setValue('-');
		$('diabetesYears').disable();
		$('diabetesType').disable();
	}
}

function checkOtherLesions() {
	if ($('otherLesions').getValue() == 'Other') {
		$('otherLesionsMisc').enable();
		$('otherLesionsMisc').show();
	}
	else {
		$('otherLesionsMisc').setValue('');
		$('otherLesionsMisc').hide();
		$('otherLesionsMisc').disable();
	}
}

function checkAlcohol() {
	if ($('alcohol').getValue() == 'YES')
		$('alcoholQuantity').enable();
	else {
		$('alcoholQuantity').setValue('-');
		$('alcoholQuantity').disable();
	}
}

function checkTobacco() {
	if ($('tobacco').getValue() == 'YES')
		$('tobaccoQuantity').enable();
	else {
		$('tobaccoQuantity').clear();
		$('tobaccoQuantity').disable();
	}
}

function checkGeographicOrigin() {
	if ($('geographicOrigin').getValue() == 'Other') {
		$('otherGeographicOrigin').enable();
	}
	else {
		$('otherGeographicOrigin').clear();
		$('otherGeographicOrigin').disable();
	}
}

function checkFamilyMalignantPrimaryTumors() {
	if ($('familyMalignantPrimaryLiverTumors').getValue() == 'YES') {
		$('familyMalignantPrimaryLiverTumorsDescription').enable();
	}
	else {
		$('familyMalignantPrimaryLiverTumorsDescription').clear();
		$('familyMalignantPrimaryLiverTumorsDescription').disable();
	}
}

function checkFamilyHistoryTumors() {
	if ($('familyHistoryMalignantTumors').getValue() == 'YES') {
		$('familyHistoryMalignantTumorsDescription').enable();
	}
	else {
		$('familyHistoryMalignantTumorsDescription').clear();
		$('familyHistoryMalignantTumorsDescription').disable();
	}
}

function checkPreSurgeryTreatment() {
	if ($('preSurgeryTreatment').getValue() == 'YES') {
		$('preSurgeryTreatmentDetail').enable();
	}
	else {
		$('preSurgeryTreatmentDetail').setValue('-');
		$('preSurgeryTreatmentDetail').disable();
	}
}

function checkPreSurgeryTreatmentOther() {
	if ($('preSurgeryTreatmentDetail').options[4].selected == true
			&& $('preSurgeryTreatmentDetail').options[5].selected == false) {
		$('preSurgeryTreatmentDetailOther').enable();
	}
	else if ($('preSurgeryTreatmentDetail').options[5].selected == true) {
		$('preSurgeryTreatmentDetail').options[0].selected = false;
		$('preSurgeryTreatmentDetail').options[1].selected = false;
		$('preSurgeryTreatmentDetail').options[2].selected = false;
		$('preSurgeryTreatmentDetail').options[3].selected = false;
		$('preSurgeryTreatmentDetail').options[4].selected = false;
		$('preSurgeryTreatmentDetailOther').disable();
		$('preSurgeryTreatmentDetailOther').clear();
	}
	else {
		$('preSurgeryTreatmentDetailOther').disable();
		$('preSurgeryTreatmentDetailOther').clear();
	}
}

function checkLongTermDrugs() {
	if ($('longTermDrugs').getValue() == 'YES') {
		$('longTermDrugsYears').enable();
		$('longTermDrugsTypes').enable();
	}
	else {
		$('longTermDrugsYears').clear();
		$('longTermDrugsYears').disable();
		$('longTermDrugsTypes').disable();
		$('longTermDrugsTypes').options[0].selected = false;
		$('longTermDrugsTypes').options[1].selected = false;
		$('longTermDrugsTypes').options[2].selected = false;
		$('longTermDrugsTypes').options[3].selected = false;
		$('longTermDrugsTypes').options[4].selected = false;
		$('longTermDrugsTypes').options[5].selected = true;
	}
}

function checkLongTermDrugsOther() {
	if ($('longTermDrugsTypes').options[4].selected == true
			&& $('longTermDrugsTypes').options[5].selected == false) {
		$('longTermDrugsMisc').enable();
	}
	else if ($('longTermDrugsTypes').options[5].selected == true) {
		$('longTermDrugsMisc').disable();
		$('longTermDrugsMisc').clear();
		$('longTermDrugsTypes').options[0].selected = false;
		$('longTermDrugsTypes').options[1].selected = false;
		$('longTermDrugsTypes').options[2].selected = false;
		$('longTermDrugsTypes').options[3].selected = false;
		$('longTermDrugsTypes').options[4].selected = false;
	}
	else {
		$('longTermDrugsMisc').clear();
		$('longTermDrugsMisc').disable();
	}
}

function checkFamilyDiabetes() {
	if ($('familyDiabetes').getValue() == 'YES') {
		$('familyDiabetesType').enable();
	}
	else {
		$('familyDiabetesType').options[0].selected = false;
		$('familyDiabetesType').options[1].selected = false;
		$('familyDiabetesType').options[2].selected = false;
		$('familyDiabetesType').options[3].selected = true;
		$('familyDiabetesType').disable();
	}
}

function checkFamilyDiabetesType() {
	if ($('familyDiabetesType').options[3].selected == true) {
		$('familyDiabetesType').options[0].selected = false;
		$('familyDiabetesType').options[1].selected = false;
		$('familyDiabetesType').options[2].selected = false;
	}
}

function checkTreatmentRegimen() {
	if ($('familyTreatmentRegimen').options[4].selected == true) {
		$('familyTreatmentRegimen').options[0].selected = false;
		$('familyTreatmentRegimen').options[1].selected = false;
		$('familyTreatmentRegimen').options[2].selected = false;
		$('familyTreatmentRegimen').options[3].selected = false;
	}
}

function checkHistologicalPattern() {
	if ($('histologicalPattern').options[6].selected == true) {
		$('histologicalPattern').options[0].selected = false;
		$('histologicalPattern').options[1].selected = false;
		$('histologicalPattern').options[2].selected = false;
		$('histologicalPattern').options[3].selected = false;
		$('histologicalPattern').options[4].selected = false;
		$('histologicalPattern').options[5].selected = false;
	}
}

function checkRelapseTreatment() {
	if ($('relapseTreatment').options[5].selected == true
			&& $('relapseTreatment').options[6].selected == false) {
		$('relapseTreatmentMisc').enable();
	}
	else {
		if ($('relapseTreatment').options[6].selected == true) {
			$('relapseTreatment').options[0].selected = false;
			$('relapseTreatment').options[1].selected = false;
			$('relapseTreatment').options[2].selected = false;
			$('relapseTreatment').options[3].selected = false;
			$('relapseTreatment').options[4].selected = false;
			$('relapseTreatment').options[5].selected = false;
		}
		$('relapseTreatmentMisc').setValue('');
	}
}